Skip to content

Commit 34b24b2

Browse files
committed
Make queue client timeout idempotent using effects
1 parent cc08f7c commit 34b24b2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Core/Cleipnir.ResilientFunctions/Queuing/QueueClient.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ public Task<Envelope> PullEnvelope<T>(Workflow workflow, EffectId parentId, Func
4141
var receiverId = parentId.CreateChild(3);
4242
var senderId = parentId.CreateChild(4);
4343

44+
if (timeout != null)
45+
{
46+
var timeoutTicks = await effect.CreateOrGet(
47+
timeoutId,
48+
timeout.Value.ToUniversalTime().Ticks,
49+
flush: false,
50+
alias: null
51+
);
52+
53+
timeout = new DateTime(timeoutTicks, DateTimeKind.Utc);
54+
}
55+
56+
4457
if (!effect.Contains(messageId))
4558
{
4659
var result = await queueManager.Subscribe(

0 commit comments

Comments
 (0)