Skip to content

Commit

Permalink
[#115] Simple prefill guard
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Nov 3, 2020
1 parent 8b38a4c commit 1a62caf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/libpgagroal/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,12 @@ pgagroal_get_connection(void* shmem, char* username, char* database, bool reuse,
ZF_LOGD("pgagroal_get_connection: Slot %d FD %d - Error", *slot, config->connections[*slot].fd);
status = pgagroal_kill_connection(shmem, *slot);

if (!fork())
if (config->number_of_users > 0 && config->number_of_limits > 0)
{
pgagroal_prefill(shmem, false);
if (!fork())
{
pgagroal_prefill(shmem, false);
}
}

if (status == 0)
Expand Down Expand Up @@ -525,7 +528,7 @@ pgagroal_idle_timeout(void* shmem)
}
}

if (prefill)
if (prefill && config->number_of_users > 0 && config->number_of_limits > 0)
{
if (!fork())
{
Expand Down Expand Up @@ -608,7 +611,7 @@ pgagroal_validation(void* shmem)
}
}

if (prefill)
if (prefill && config->number_of_users > 0 && config->number_of_limits > 0)
{
if (!fork())
{
Expand Down Expand Up @@ -716,7 +719,7 @@ pgagroal_flush(void* shmem, int mode)
}
}

if (prefill)
if (prefill && config->number_of_users > 0 && config->number_of_limits > 0)
{
if (!fork())
{
Expand Down

0 comments on commit 1a62caf

Please sign in to comment.