I'm confused by this approach. If the intent is to change the behavior of the pool to always use a wait queue, then it would be simpler to have all replies be async and not do some retries here. However, I will not merge anything that makes such a fundamental change. If we want to add queue wait to pooler, it needs to be opt-in and not disturb existing functionality. If you need queue wait, you might look at poolboy, I think it does that.