You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use case: need to wait for channel A has msg but channel B is empty. It’s very hard to workaround atm.
More details / context: a main thread starts a side thread. The side thread runs as a loop to wait for an action channel for a msg. When receives a message, make an action then go back to wait for next one.
Main thread then send the msg anytime. When the main thread exists, we want to drain the msg for the side thread and then complete the workflow.
Main thread cannot use force complete because side thread could still be running or there are more msg in the channel. We can’t use graceful complete on both because side thread will always running as a loop.
Current workaround is to let main thread graceful complete also set a DA and send a msg to a special channel to tell side thread to attempt to complete when the channel is empty. Then side thread would wait on the msg. On receiving the msg, stop waiting for the action channel , then use the DA to switch to use conditional complete to go to the loop.
Better workaround 2: , instead of a new channel and data attribute , send a NULL to the action channel instead. When receiving the NULL, then graceful complete —- because of the FIFO nature of a single channel —- this can be extended to wait for multiple NULLs for more complex cases (use a counter to track how many NULLs have been received)
Workaround 3: just use persistence locking to make multi threading running in series
The text was updated successfully, but these errors were encountered:
longquanzheng
changed the title
New command to wait for check a channel is empty
New command to waitUntil a channel becomes empty
Sep 11, 2024
longquanzheng
changed the title
New command to waitUntil a channel becomes empty
[need use case]New command to waitUntil a channel becomes empty
Sep 11, 2024
longquanzheng
changed the title
[need use case]New command to waitUntil a channel becomes empty
New command to waitUntil a channel becomes empty
Sep 13, 2024
longquanzheng
changed the title
New command to waitUntil a channel becomes empty
[Maybe][DesignPattern]New command to waitUntil a channel becomes empty
Sep 13, 2024
Use case: need to wait for channel A has msg but channel B is empty. It’s very hard to workaround atm.
More details / context: a main thread starts a side thread. The side thread runs as a loop to wait for an action channel for a msg. When receives a message, make an action then go back to wait for next one.
Main thread then send the msg anytime. When the main thread exists, we want to drain the msg for the side thread and then complete the workflow.
Main thread cannot use force complete because side thread could still be running or there are more msg in the channel. We can’t use graceful complete on both because side thread will always running as a loop.
Current workaround is to let main thread graceful complete also set a DA and send a msg to a special channel to tell side thread to attempt to complete when the channel is empty. Then side thread would wait on the msg. On receiving the msg, stop waiting for the action channel , then use the DA to switch to use conditional complete to go to the loop.
Better workaround 2: , instead of a new channel and data attribute , send a NULL to the action channel instead. When receiving the NULL, then graceful complete —- because of the FIFO nature of a single channel —- this can be extended to wait for multiple NULLs for more complex cases (use a counter to track how many NULLs have been received)
Workaround 3: just use persistence locking to make multi threading running in series
The text was updated successfully, but these errors were encountered: