Skip to content

Attach DuckDB connection pool using Kestrel connection API instead of middleware  #5423

@qodo-code-review

Description

@qodo-code-review

Description

  • Current implementation uses middleware to attach lazy DuckDB connection pools to HTTP connections, adding unnecessary complexity to the request pipeline
  • Pool instantiation is cheap (only parses connection string, no IO), making lazy initialization unnecessary
  • Kestrel provides a more suitable API for managing per-connection state through connection context items

Deliverables

  • Remove middleware: Delete DuckDbConnectionPoolMiddleware and its registration from the startup pipeline
  • Implement Kestrel API: Add connection-level pool attachment using ListenOptions.Use() in KestrelHelpers
  • Update references: Change all Lazy<DuckDBConnectionPool> parameters to DuckDBConnectionPool throughout index read operations
  • Add extension: Create HttpContextExtensions.GetDuckDbConnectionPool() for retrieving pools from HTTP context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions