switch_pgsql.c switch_pgsql_next_result_timed() was using switch_time_now() for start time and switch_micro_time_now() for current time. These are different time sources that may not be in sync and could cause the query to timeout prematurely.

This commit is contained in:
Chris Rienzo 2014-10-07 09:33:19 -04:00
parent da43bdeb12
commit 4a5e36d63e

View File

@ -305,7 +305,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsq
if (PQisBusy(handle->con)) { if (PQisBusy(handle->con)) {
/* Wait for a result to become available, up to msec milliseconds */ /* Wait for a result to become available, up to msec milliseconds */
start = switch_time_now(); start = switch_micro_time_now();
while((ctime = switch_micro_time_now()) - start <= usec) { while((ctime = switch_micro_time_now()) - start <= usec) {
int wait_time = (usec - (ctime - start)) / 1000; int wait_time = (usec - (ctime - start)) / 1000;
fds[0].fd = handle->sock; fds[0].fd = handle->sock;