From 7dff96d3b6e9190ef9c80d0bf7a4d51126fb9d7c Mon Sep 17 00:00:00 2001 From: "Stephen R. van den Berg" <srb@cuci.nl> Date: Thu, 4 Jun 2020 17:11:04 +0200 Subject: [PATCH] pgsql: Catch very fast resync responses. --- lib/modules/Sql.pmod/pgsql.pike | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike index 8941eecc63..c5cda7f21a 100644 --- a/lib/modules/Sql.pmod/pgsql.pike +++ b/lib/modules/Sql.pmod/pgsql.pike @@ -568,12 +568,10 @@ private void resync_cb() { resynced = Thread.Condition(); resyncmux = Thread.Mutex(); } + Thread.MutexKey lock = resyncmux->lock(); proxy.readyforquery_cb = resync_cb; proxy.sendsync(); - if (proxy.readyforquery_cb) { - Thread.MutexKey lock = resyncmux->lock(); - resynced.wait(lock); // Wait for the db to finish - } + resynced.wait(lock); // Wait for the db to finish } return; }; -- GitLab