Skip to content

Commit

Permalink
Fix for waiting connections handling for cancel requests
Browse files Browse the repository at this point in the history
When the connection pool is full, cancel requests cannot get through (that is normal), but then when unused connections close and pool slots are available, those are not used for waiting cancel requests.

The fix is to launch new connections when cancel requests are queued and pool slots are available.

closes #542
see also #245
  • Loading branch information
thanodnl committed Feb 4, 2021
1 parent 077793c commit 8df8f41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/janitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ static void per_loop_activate(PgPool *pool)
PgSocket *client;
int sv_tested, sv_used;

/* if there is a cancel request waiting, open a new connection */
if (!statlist_empty(&pool->cancel_req_list)) {
launch_new_connection(pool);
return;
}

/* see if any server have been freed */
sv_tested = statlist_count(&pool->tested_server_list);
sv_used = statlist_count(&pool->used_server_list);
Expand Down

0 comments on commit 8df8f41

Please sign in to comment.