asyncpg
asyncpg copied to clipboard
Handle PROTOCOL_CANCELLED (state 3) in _dispatch_result.
Prior to this patch the state machine did not handle results arriving after cancellation. This add explicit support for that scenario by keeping track of the state prior to cancellation (cancelled_from_state), and using cancelled_from_state when consuming the results.
The alternative option is just silently dropping the results (similar to PROTOCOL_TERMINATING).
Would maybe close https://github.com/MagicStack/asyncpg/issues/490
Upon reflection I'm not sure this is the best approach.. it would possibly leave a connection in a state that's unexpected by the client. Needs further thought.