From 39b19b0ca9d004b4cbe67d2f09c2a1e9eab03c19 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 22:08:18 +0200 Subject: -fix busy loop --- src/pq/pq_event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/pq') diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index bf845db18..e6c2d07fd 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c @@ -192,7 +192,11 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) GNUNET_assert (0 == pthread_mutex_lock (&db->notify_lock)); - PQconsumeInput (db->conn); + if (1 != + PQconsumeInput (db->conn)) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to read from Postgres: %s\n", + PQerrorMessage (db->conn)); while (NULL != (n = PQnotifies (db->conn))) { struct GNUNET_ShortHashCode sh; @@ -264,7 +268,7 @@ do_scheduler_notify (void *cls) GNUNET_assert (NULL != db->rfd); GNUNET_PQ_event_do_poll (db); db->event_task - = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_ZERO, + = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, db->rfd, &do_scheduler_notify, db); -- cgit v1.2.3