What is the mechanism by which workflow tasks know which code to run?
For example, IIUC, all of the following would dictate that certain parts of the workflow definition would run. In these cases, how does the SDK/temporal know which code to run?
- when an awaited activity result gets completed
- when a workflow gets cancelled
- when a signal is received
- when a condition unblocks
- when a timer fires
As a related question, is there an internal list of awaited tasks that need to be checked at certain points? I believe this is a sort of internal/custom event loop within the SDKs. And if so, when does that list get checked? My suspicion is that it gets checked (and runs any unblocked tasks) just before a workflow task would otherwise be completed. For example, processing a signal may unblock an condition, and the task associated with the unblocked condition would run in the same workflow task as the signal processing.