Skip to content

fix(database): add retry logic for PostgreSQL connection pool#826

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
MerlinTheWhiz:fix/postgres-pool-retry
Jun 29, 2026
Merged

fix(database): add retry logic for PostgreSQL connection pool#826
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
MerlinTheWhiz:fix/postgres-pool-retry

Conversation

@MerlinTheWhiz

Copy link
Copy Markdown
Contributor

Description

Add automatic retry logic with exponential backoff and a circuit breaker to the PostgreSQL connection pool. When a transient connection error occurs, the pool now:

  • Retries failed queries up to 3 times using retryWithBackoff() from src/utils/errorUtils.ts
  • Automatically reconnects on idle client errors via the pool's error event
  • Queues queries issued during the reconnect window and processes them once the connection is restored
  • Trips a circuit breaker after 5 consecutive failures, immediately returning a 503 error for subsequent queries
  • Resets the circuit breaker after a 60-second cooldown period or upon a successful new connection

Related Issue

Closes #739

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@MerlinTheWhiz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit cb77fa6 into rinafcode:main Jun 29, 2026
4 checks passed
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.

[Performance] PostgreSQL connection pool has no retry logic on connection error

2 participants