The workflow run listener could previously only handle a single subscriber per workflow run id, and didn't replay requests when the listener was interrupted (due to a broken network connection). This meant that workflows could get stuck in a state where they were listening forever.
This PR makes the following changes:
Creates a new subscription per subscribe request (which is called by the result method), and properly cleans up subscriptions when subscriptions close
Replays the subscription history on connection reset, so that resetting a connection doesn't cause listeners to wait forever for new events
Adds a timer to restart the listener connection every 30 minutes. We have seen some indication that gRPC is not handling idle states particularly well
Cleans up the subscriptions when a parent asyncio task is cancelled. This allows callers to optionally cancel result calls without worrying about connection leakage.
Properly throws an error to the result method when subscriptions fail, instead of returning a False event
The workflow run listener could previously only handle a single subscriber per workflow run id, and didn't replay requests when the listener was interrupted (due to a broken network connection). This meant that workflows could get stuck in a state where they were listening forever.
This PR makes the following changes:
subscribe
request (which is called by theresult
method), and properly cleans up subscriptions when subscriptions closeresult
calls without worrying about connection leakage.result
method when subscriptions fail, instead of returning aFalse
event