Skip to content

Commit 2ac3761

Browse files
Convert scheduledTimeUtc to UTC in SignalEntityAsync (#1690)
convert scheduledTimeUtc to UTC in SignalEntityAsync, to make sure it is indeed UTC
1 parent 3f4b27e commit 2ac3761

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ private async Task SignalEntityAsyncInternal(DurableClient durableClient, string
297297
throw new ArgumentNullException(nameof(operationName));
298298
}
299299

300+
if (scheduledTimeUtc.HasValue)
301+
{
302+
scheduledTimeUtc = scheduledTimeUtc.Value.ToUniversalTime();
303+
}
304+
300305
if (this.ClientReferencesCurrentApp(durableClient))
301306
{
302307
this.config.ThrowIfFunctionDoesNotExist(entityId.EntityName, FunctionType.Entity);

test/Common/DurableTaskEndToEndTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3446,9 +3446,11 @@ public async Task DurableEntity_ContinueAsNewBetweenCalls(bool extendedSessions)
34463446
/// </summary>
34473447
[Theory]
34483448
[Trait("Category", PlatformSpecificHelpers.TestCategory)]
3449-
[InlineData(true)]
3450-
[InlineData(false)]
3451-
public async Task DurableEntity_ScheduledSignal(bool extendedSessions)
3449+
[InlineData(true, true)]
3450+
[InlineData(false, true)]
3451+
[InlineData(true, false)]
3452+
[InlineData(false, false)]
3453+
public async Task DurableEntity_ScheduledSignal(bool extendedSessions, bool useUtc)
34523454
{
34533455
using (var host = TestHelpers.GetJobHost(
34543456
this.loggerProvider,
@@ -3463,7 +3465,7 @@ public async Task DurableEntity_ScheduledSignal(bool extendedSessions)
34633465
// Wait 8 seconds to account for time to grab ownership lease.
34643466
await Task.Delay(8000);
34653467

3466-
var now = DateTime.UtcNow;
3468+
var now = useUtc ? DateTime.UtcNow : DateTime.Now;
34673469

34683470
await client.SignalEntity(this.output, now + TimeSpan.FromSeconds(4), "delayed", null);
34693471
await client.SignalEntity(this.output, "immediate", null);

0 commit comments

Comments
 (0)