diff options
Diffstat (limited to 'contrib/postgres_fdw/connection.c')
-rw-r--r-- | contrib/postgres_fdw/connection.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c index 9ef2d1336ef..f382203b8f3 100644 --- a/contrib/postgres_fdw/connection.c +++ b/contrib/postgres_fdw/connection.c @@ -1140,20 +1140,15 @@ pgfdw_get_cleanup_result(PGconn *conn, TimestampTz endtime, PGresult **result) { int wc; TimestampTz now = GetCurrentTimestamp(); - long secs; - int microsecs; long cur_timeout; /* If timeout has expired, give up, else get sleep time. */ - if (now >= endtime) + cur_timeout = TimestampDifferenceMilliseconds(now, endtime); + if (cur_timeout <= 0) { timed_out = true; goto exit; } - TimestampDifference(now, endtime, &secs, µsecs); - - /* To protect against clock skew, limit sleep to one minute. */ - cur_timeout = Min(60000, secs * USECS_PER_SEC + microsecs); /* Sleep until there's something to do */ wc = WaitLatchOrSocket(MyLatch, |