29 Oct 2024 11:36 AM
I made an interesting observation today, which seems like a race condition when triggering an SRG from a workflow.
I have this situation:
| sort timestamp desc
| limit 1
should give us the exact last injected BizEvent. But it sometimes isn't...it's the previous one.
I have tested this by adding a time delay on the workflow, to have it wait 30s between the trigger and the SRG execution. Then this works.
So could it really be that the WF triggers are executed directly upon ingest before the bizevent is actually persisted so it can be queried by DQL?
Solved! Go to Solution.
29 Oct 2024 12:32 PM
Do you mean the workflow is fired before the Bizevent is available in the Bizevents table?
Did you confirm the event firing the Workflow was present after some time?
29 Oct 2024 02:34 PM
@PacoPorro yes that is correct and confirmed by @ChristopherHejl .
This is important to know, because with this behavior it means that a new BizEvent can trigger a workflow which then works on old data 🙂
Simple workaround: you need to add a delay on the srg execution task.
29 Oct 2024 01:57 PM
You are correct. The workflow is triggered as soon as the event is coming in, but Grail might take 10-15 seconds until the new data point is stored and is returned by queries.
We are looking into delaying event triggers internally to get around this, but not confirmed yet.
29 Oct 2024 02:34 PM
Thanks for confirming this!