Skip to content

Execute Listen and Unlisten while waiting on Notifications #2087

Answered by jackc
jdabbs003 asked this question in Q&A
Discussion options

You must be logged in to vote

*pgx.Conn is not concurrency safe, so you can't use two goroutines. You would need to cancel the context passed to WaitForNotification, then execute your listen or unlisten, then recall WaitForNotification.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jdabbs003
Comment options

@jackc
Comment options

Answer selected by jdabbs003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants