Skip to content

Improve or clarify connection pool handling #208

@iby

Description

@iby

@porsager Taking conversation in #206 separate.

I've run into an issue with integration tests started failing with PostgresError: relation "…" does not exist error. This happened on every 10th query. What's interesting, after the error the next 9 queries ran fine and then the same thing would happen with 10th. I'm on v2.0.0-beta.6.

After reading closely about the connection pool I fixed it with increasing max (from default 10) and setting idle_timeout=0.001. Two things I found odd:

  1. Query connection doesn't get disposed right away and it doesn't get reused for consecutive queries. What's the purpose keeping it around then?
  2. idle_timeout=0 doesn't work because of the falsy check, but I'd expect it to act as an indicator that already used query connections should get disposed right away.

Hence, it's not clear what's the right way to set up the connection in order to run an unlimited number of consecutive queries. Even with the current setup it seems I'm relying on idle_timeout clearing connections. I understand that I probably will never hit the limit with such a timeout, but it feels like a race to me. Can you elaborate on this?

P.S. Thanks for this awesome package! Absolutely fantastic! ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions