Skip to content

Commit

Permalink
Fix: DateTime parsing with InvariantCulture (#1590)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikoloz.Gobejishvili <Nikoloz.Gobejishvili@SPLP1011>
  • Loading branch information
NikolozGob and Nikoloz.Gobejishvili authored Sep 26, 2024
1 parent 9b1b112 commit cd6d0ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/DotNetCore.CAP/ICapTransaction.Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Concurrent;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP.Messages;
Expand Down Expand Up @@ -55,7 +56,7 @@ protected virtual void Flush()
if (isDelayMessage)
{

_dispatcher.EnqueueToScheduler(message, DateTime.Parse(message.Origin.Headers[Headers.SentTime]!)).ConfigureAwait(false);
_dispatcher.EnqueueToScheduler(message, DateTime.Parse(message.Origin.Headers[Headers.SentTime]!, CultureInfo.InvariantCulture)).ConfigureAwait(false);

}
else
Expand Down
5 changes: 3 additions & 2 deletions src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics;
Expand Down Expand Up @@ -142,11 +143,11 @@ private async Task PublishInternalAsync<T>(string name, T? value, IDictionary<st
{
publishTime += delayTime.Value;
headers.Add(Headers.DelayTime, delayTime.Value.ToString());
headers.Add(Headers.SentTime, publishTime.ToString());
headers.Add(Headers.SentTime, publishTime.ToString(CultureInfo.InvariantCulture));
}
else
{
headers.Add(Headers.SentTime, publishTime.ToString());
headers.Add(Headers.SentTime, publishTime.ToString(CultureInfo.InvariantCulture));
}

var message = new Message(headers, value);
Expand Down

0 comments on commit cd6d0ee

Please sign in to comment.