Skip to content

Commit

Permalink
Merge pull request #30 from AlexanderKholodov46/updaters-fix
Browse files Browse the repository at this point in the history
Do not reset the flowId / timestamp key if it is already set.
  • Loading branch information
Nikolay Pianikov committed Dec 10, 2019
2 parents 089836b + 34f7e8e commit 9bc2431
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public FlowMessageUpdater([NotNull] IFlowIdGenerator flowId) : this(flowId.NewFl

public IServiceMessage UpdateServiceMessage(IServiceMessage message)
{
return message.DefaultValue != null ? message : new PatchedServiceMessage(message) {{"flowId", FlowId}};
return message.DefaultValue != null || message.GetValue("flowId") != null ? message : new PatchedServiceMessage(message) { { "flowId", FlowId } };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace JetBrains.TeamCity.ServiceMessages.Write.Special.Impl.Updater
{
using System;
using System.Globalization;
using System.Linq;

/// <summary>
/// Service message updater that adds Timestamp to service message according to
Expand All @@ -35,7 +36,7 @@ public TimestampUpdater([NotNull] Func<DateTime> timeService)
public IServiceMessage UpdateServiceMessage(IServiceMessage message)
{
if (message == null) throw new ArgumentNullException(nameof(message));
if (message.DefaultValue != null) return message;
if (message.DefaultValue != null || message.GetValue("timestamp") != null) return message;
return new PatchedServiceMessage(message) {{"timestamp", _timeService().ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss.fff", CultureInfo.InvariantCulture) + "+0000"}};
}
}
Expand Down

0 comments on commit 9bc2431

Please sign in to comment.