@@ -35,7 +35,15 @@ await functionStore.CreateFunction(
3535 owner : null
3636 ) ;
3737 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
38- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
38+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
39+ using var registeredTimeouts = new FlowRegisteredTimeouts (
40+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
41+ ( ) => DateTime . UtcNow ,
42+ minimumTimeout ,
43+ t => messagesWriter . AppendMessage ( t ) ,
44+ new UnhandledExceptionHandler ( _ => { } ) ,
45+ flowId
46+ ) ;
3947 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
4048 storedId ,
4149 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -103,7 +111,15 @@ await functionStore.CreateFunction(
103111 owner : null
104112 ) ;
105113 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
106- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
114+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
115+ using var registeredTimeouts = new FlowRegisteredTimeouts (
116+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
117+ ( ) => DateTime . UtcNow ,
118+ minimumTimeout ,
119+ t => messagesWriter . AppendMessage ( t ) ,
120+ new UnhandledExceptionHandler ( _ => { } ) ,
121+ flowId
122+ ) ;
107123 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
108124 storedId ,
109125 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -145,7 +161,15 @@ await functionStore.CreateFunction(
145161 owner : null
146162 ) ;
147163 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
148- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
164+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
165+ using var registeredTimeouts = new FlowRegisteredTimeouts (
166+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
167+ ( ) => DateTime . UtcNow ,
168+ minimumTimeout ,
169+ t => messagesWriter . AppendMessage ( t ) ,
170+ new UnhandledExceptionHandler ( _ => { } ) ,
171+ flowId
172+ ) ;
149173 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
150174 storedId ,
151175 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -187,7 +211,15 @@ await functionStore.CreateFunction(
187211 owner : null
188212 ) ;
189213 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
190- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
214+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
215+ using var registeredTimeouts = new FlowRegisteredTimeouts (
216+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
217+ ( ) => DateTime . UtcNow ,
218+ minimumTimeout ,
219+ t => messagesWriter . AppendMessage ( t ) ,
220+ new UnhandledExceptionHandler ( _ => { } ) ,
221+ flowId
222+ ) ;
191223 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
192224 storedId ,
193225 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -231,7 +263,15 @@ await functionStore.CreateFunction(
231263 owner : null
232264 ) ;
233265 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
234- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
266+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
267+ using var registeredTimeouts = new FlowRegisteredTimeouts (
268+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
269+ ( ) => DateTime . UtcNow ,
270+ minimumTimeout ,
271+ t => messagesWriter . AppendMessage ( t ) ,
272+ new UnhandledExceptionHandler ( _ => { } ) ,
273+ flowId
274+ ) ;
235275 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
236276 storedId ,
237277 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -280,7 +320,15 @@ await functionStore.CreateFunction(
280320 owner : null
281321 ) ;
282322 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
283- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
323+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
324+ using var registeredTimeouts = new FlowRegisteredTimeouts (
325+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
326+ ( ) => DateTime . UtcNow ,
327+ minimumTimeout ,
328+ t => messagesWriter . AppendMessage ( t ) ,
329+ new UnhandledExceptionHandler ( _ => { } ) ,
330+ flowId
331+ ) ;
284332 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
285333 storedId ,
286334 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -328,7 +376,15 @@ await functionStore.CreateFunction(
328376 owner : null
329377 ) ;
330378 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
331- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
379+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
380+ using var registeredTimeouts = new FlowRegisteredTimeouts (
381+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
382+ ( ) => DateTime . UtcNow ,
383+ minimumTimeout ,
384+ t => messagesWriter . AppendMessage ( t ) ,
385+ new UnhandledExceptionHandler ( _ => { } ) ,
386+ flowId
387+ ) ;
332388 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
333389 storedId ,
334390 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -372,7 +428,15 @@ await functionStore.CreateFunction(
372428 owner : null
373429 ) ;
374430 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
375- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
431+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
432+ using var registeredTimeouts = new FlowRegisteredTimeouts (
433+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
434+ ( ) => DateTime . UtcNow ,
435+ minimumTimeout ,
436+ t => messagesWriter . AppendMessage ( t ) ,
437+ new UnhandledExceptionHandler ( _ => { } ) ,
438+ flowId
439+ ) ;
376440 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
377441 storedId ,
378442 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -428,7 +492,15 @@ await functionStore.CreateFunction(
428492 owner : null
429493 ) ;
430494 var messagesWriter = new MessageWriter ( storedId , functionStore , DefaultSerializer . Instance , scheduleReInvocation : ( _ , _ ) => Task . CompletedTask ) ;
431- var registeredTimeouts = new RegisteredTimeouts ( storedId , functionStore . TimeoutStore , CreateEffect ( storedId , flowId , functionStore ) , ( ) => DateTime . UtcNow ) ;
495+ var minimumTimeout = new FlowMinimumTimeout ( ) ;
496+ using var registeredTimeouts = new FlowRegisteredTimeouts (
497+ CreateEffect ( storedId , flowId , functionStore , minimumTimeout ) ,
498+ ( ) => DateTime . UtcNow ,
499+ minimumTimeout ,
500+ t => messagesWriter . AppendMessage ( t ) ,
501+ new UnhandledExceptionHandler ( _ => { } ) ,
502+ flowId
503+ ) ;
432504 var messagesPullerAndEmitter = new MessagesPullerAndEmitter (
433505 storedId ,
434506 defaultDelay : TimeSpan . FromMilliseconds ( 250 ) ,
@@ -587,11 +659,11 @@ async Task<string> (_, workflow) => (await workflow.Messages.First(maxWait: Time
587659 result . ShouldBe ( "Hallo World!" ) ;
588660 }
589661
590- private Effect CreateEffect ( StoredId storedId , FlowId flowId , IFunctionStore functionStore )
662+ private Effect CreateEffect ( StoredId storedId , FlowId flowId , IFunctionStore functionStore , FlowMinimumTimeout flowMinimumTimeout )
591663 {
592664 var lazyExistingEffects = new Lazy < Task < IReadOnlyList < StoredEffect > > > ( ( ) => Task . FromResult ( ( IReadOnlyList < StoredEffect > ) new List < StoredEffect > ( ) ) ) ;
593665 var effectResults = new EffectResults ( flowId , storedId , lazyExistingEffects , functionStore . EffectsStore , DefaultSerializer . Instance ) ;
594- var effect = new Effect ( effectResults , utcNow : ( ) => DateTime . UtcNow ) ;
666+ var effect = new Effect ( effectResults , utcNow : ( ) => DateTime . UtcNow , flowMinimumTimeout ) ;
595667 return effect ;
596668 }
597669
0 commit comments