Skip to content

Commit

Permalink
Move i/o before in-memory side effect in RegisteredTimeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed Aug 6, 2024
1 parent 453cbf2 commit b299eae
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ public async Task RegisterTimeout(TimeoutId timeoutId, DateTime expiresAt)
lock (_sync)
if (registeredTimeouts.ContainsKey(timeoutId.Value))
return;
else
registeredTimeouts[timeoutId] = new RegisteredTimeout(timeoutId, expiresAt.ToUniversalTime());

expiresAt = expiresAt.ToUniversalTime();
await timeoutStore.UpsertTimeout(
new StoredTimeout(flowId, timeoutId.Value, expiresAt.Ticks),
overwrite: true
);

lock (_sync)
registeredTimeouts[timeoutId] = new RegisteredTimeout(timeoutId, expiresAt.ToUniversalTime());
}

public Task RegisterTimeout(TimeoutId timeoutId, TimeSpan expiresIn)
Expand Down

0 comments on commit b299eae

Please sign in to comment.