sdk-core icon indicating copy to clipboard operation
sdk-core copied to clipboard

[Feature Request] Add flag to disable signal/update reordering

Open Sushisource opened this issue 9 months ago • 3 comments

As described in the docstring update in https://github.com/temporalio/sdk-core/pull/639, the reordering of signals/queries to come first is more a byproduct of language runtime specifics than anything else.

Languages that can control the iteration of routines/tasks/whatever, don't need this reordering, and in fact it prevents one specific case that seems like it should work from working:

Say your history has something like:

...
activity completed
signaled
WFT Sched & Start

If I reorder jobs such that lang sees [signal, activity resolve]

Then code that looks like this:

fn signal_handler() {
    if that_activity_future.is_completed() {
        // do a thing
    }
}

Will not enter the if condition, since the signal handler is invoked first. However it seemingly should, according to history, since the activity is completed before the signal is received.

Rust SDK should make use of the more accurate behavior, since it can. Ideally, Python and .NET would too since they have this control, though that could potentially represent a breaking change. If we could confirm it's nonbreaking, we could do it, but not exactly important.

Sushisource avatar Nov 20 '23 23:11 Sushisource