2025-08-28 - Wrapping Awaiting Multiple Steps with Step

From Izara Wiki
Jump to navigation Jump to search

Overview

Rule for Awaiting Multiple Steps (AMS) is we must save all AMS before sending any async requests (eg to other flows) to protect against the sent requests returning before saving all AMS causing a race condition where the parent task completes because it thinks all steps are complete but actually they have not been saved yet.

This is not efficient for large scale processes such as ImportBatch.

Solution is to add a special step into the main AMS group before sending any async requests, and removing that step after all steps are complete.

This will result in there always being a step remaining if some steps return before others have been saved, protecting against the AMS group completing prematurely.

After saving the last AMS and removing the special step probably need to check if AMS finished, not rely on async requests to return to check finished, to protect against all external requests completing before removing the special step which would mean there are no async requests remaining after deleting the special step.