Hi Nen,
This is a fairly common question when using timeouts with sagas.
For your case, you could add another property to your saga data class, let’s say we call it SalesRequestedMoreTime
as a boolean. In the handling method of the SalesRequestsMoreTime message, you would set that value to true. Then, in the Timeout method you’ve already got, you’d check that property and if it’s false, do what you’re already doing, and if it’s true, then request a second timeout.
Important: In order to not end up in an endless timeout loop, essentially breaking the original requirement, you’ll need to have some mechanism to detect when you’re going through the timeout the second time. You could reset the SalesRequestedMoreTime
property to false, or you could use a different type of parameter for the timeout and create a new timeout method to handle that, just as a couple of examples.
Let me know how that works out for you.
Cheers,
Udi