Closed
Description
The current Listen
/Notify
is not usable in a structured concurrency context. We should provide something better:
Goals
-
Provide a new method on connection:
public func listen(_ channel: String) async throws -> PostgresNotificationSequence
-
The new
PostgresNotificationSequence
can be backed by anAsyncThrowingStream<String>
internally. However we should not expose this, as this gives us greater flexibility down the road. -
We should create a
ListenStateMachine
in the PostgresConnection that we update for each Listen channel.