Skip to content

Add connection limits support#121

Draft
EDsCODE wants to merge 1 commit intomainfrom
feature/connection-limits
Draft

Add connection limits support#121
EDsCODE wants to merge 1 commit intomainfrom
feature/connection-limits

Conversation

@EDsCODE
Copy link
Contributor

@EDsCODE EDsCODE commented Jan 30, 2026

Summary

  • Adds global connection limit to prevent resource exhaustion
  • New connections rejected when limit reached

Changes

  • Add MaxConnections to Config struct (default: 0 = unlimited)
  • Add max_connections YAML config and DUCKGRES_MAX_CONNECTIONS env var
  • Check connection count in handleConnection() using atomic counter
  • Reject connections with log warning when limit exceeded
  • Add duckgres_connection_limit_rejects_total Prometheus metric

Configuration

max_connections: 100  # or via DUCKGRES_MAX_CONNECTIONS=100

Test plan

  • Set low limit, open multiple connections - excess should be rejected
  • Verify metric increments on rejection
  • Verify connections work normally when under limit

🤖 Generated with Claude Code

Adds max_connections configuration to limit concurrent client connections:
- New MaxConnections field in Config struct
- Connection limit check in handleConnection() with atomic counter
- New duckgres_connection_limit_rejects_total metric
- DUCKGRES_MAX_CONNECTIONS env var and YAML config support
- Connections are rejected when limit is reached (default: 0 = unlimited)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@EDsCODE EDsCODE force-pushed the feature/connection-limits branch from 2614ec5 to e395fd7 Compare January 30, 2026 23:40
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.

1 participant