8000 fix: move pubsub publishing out of database transactions to avoid conn exhaustion by dannykopping · Pull Request #17648 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: move pubsub publishing out of database transactions to avoid conn exhaustion #17648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 5, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: commentary
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
  • Loading branch information
dannykopping committed May 2, 2025
commit 74f5dd78dcf48c2a8e0e42cd43440a4f2f25ab03
8 changes: 6 additions & 2 deletions enterprise/coderd/prebuilds/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ func (c *StoreReconciler) Run(ctx context.Context) {
c.running.Store(true)

// Publish provisioning jobs outside of database transactions.
// PGPubsub tries to acquire a new connection on Publish. A connection is held while a database transaction is active,
// so we can exhaust available connections.
// A connection is held while a database transaction is active; PGPubsub also tries to acquire a new connection on
// Publish, so we can exhaust available connections.
//
// A single worker dequeues from the channel, which should be sufficient.
// If any messages are missed due to congestion or errors, provisionerdserver has a backup polling mechanism which
// will periodically pick up any queued jobs (see poll(time.Duration) in coderd/provisionerdserver/acquirer.go).
go func() {
for {
select {
Expand Down
Loading
0