Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Connection pool ergonomics: timeouts, idle/lifetime caps, sync pool

Đang mở
#67 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
backend, databases

Hướng nghiên cứu

Start with hyperdb-api/src/pool.rs and §6 of docs/RUST_API_GAP_ANALYSIS.md to map the existing async pool and PoolConfig surface. Define the additive timeout, lifetime, idle, min-idle, and recycle options, then assess the sync ConnectionPool boundary and its lack of a Tokio dependency. Done means the listed options and sync pool are implemented with current defaults preserved, with tests covering timeout, idle-close, and health-check replacement behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Summary

PoolConfig is missing the standard set of options that deadpool / bb8 / r2d2 users expect (timeouts, idle/lifetime caps, min-idle, configurable health check). And there is no sync connection pool at all — pooling is async-only. Users with a sync app today either roll their own pool or block on the async one from a runtime.

Current state

hyperdb-api/src/pool.rs — PoolConfig exposes only endpoint, database, create_mode, user, password, max_size. The recycle path unconditionally runs execute_command("SELECT 1").

$ grep -n "wait_timeout\|create_timeout\|recycle_timeout\|max_lifetime\|idle_timeout\|min_idle" \
    hyperdb-api/src/pool.rs
# (no output)

Original gap analysis: §6 of docs/RUST_API_GAP_ANALYSIS.md (predecessor repo).

Proposed work

  • Add timeouts to PoolConfig:
    • wait_timeout: Option<Duration> — how long acquire will block before erroring.
    • create_timeout: Option<Duration> — bound on a single Connection::connect.
    • recycle_timeout: Option<Duration> — bound on the health-check round-trip.
  • Add lifetime/idle caps:
    • max_lifetime: Option<Duration> — connection is closed when older than this.
    • idle_timeout: Option<Duration> — idle connection is closed after this duration.
    • min_idle: Option<u32> — pool keeps at least this many warm.
  • Pluggable health-check strategy: a recycle: RecycleStrategy enum (SelectOne, Ping, Custom(...), None) instead of hardcoded SELECT 1.
  • Add a sync ConnectionPool mirroring the async pool's surface — r2d2-style — for sync apps. Same PoolConfig, same semantics, no Tokio dependency in the sync path.
  • Tests covering each new option (timeout fires, idle close fires, health-check failure replaces the connection).

Backwards compatibility

Purely additive — new optional fields default to None (current behavior preserved). New sync pool is a new public type.

Performance note

The defaults must keep current behavior identical: None everywhere (no timeout, no idle cap), recycle = SelectOne. Existing users who specify only endpoint/database/max_size should see no change.

Ngôn ngữ chính
Rust
Star
3
Fork
2
Merge trung bình
23 giờ 11 phút
Pull request đã merge (30 ngày)
65

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tableau/hyper-api-rust

Tất cả issue của tableau/hyper-api-rust

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.