I need to spawn a task, to be executed asynchronously. The task needs to read documents created/updated by the transaction that spawns it.
Because the “spawning” transaction is quite big and the task server queue is empty, the task kicks off straight away, before the first one completes.
Is there any built-in way to spawn the task to be executed only after the current transaction completes? A little bit like “post-commit triggers”, but for tasks.
Or should we handle commits “by hand”?