Skip to content

Isolate postgres subscriber cleanup#4520

Merged
NathanFlurry merged 1 commit intorivet-dev:mainfrom
diodeinc:main
Mar 27, 2026
Merged

Isolate postgres subscriber cleanup#4520
NathanFlurry merged 1 commit intorivet-dev:mainfrom
diodeinc:main

Conversation

@akhilles
Copy link
Copy Markdown
Contributor

The Postgres pubsub driver shared one CancellationToken across all subscribers for a subject, so dropping one subscriber could tear down the subject for the others too. In runner mode this could surface as a false actor_stopped path and cause retries or duplicate execution.

Give each subscriber its own cleanup task and DropGuard instead. Only UNLISTEN and remove the subject once the broadcast sender has no remaining receivers.

Fixes: #4519

The Postgres pubsub driver shared one CancellationToken across all subscribers for a subject, so dropping one subscriber could tear down the subject for the others too. In runner mode this could surface as a false actor_stopped path and cause retries or duplicate execution.

Give each subscriber its own cleanup task and DropGuard instead. Only UNLISTEN and remove the subject once the broadcast sender has no remaining receivers.
@NathanFlurry NathanFlurry merged commit 197ca99 into rivet-dev:main Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False actor_stopped from Postgres pubsub unsubscribe causes request retries / duplicate execution

2 participants