From 026de1dda4cffbb973a2192a017974a487907a37 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 5 Jan 2024 16:17:38 +0100 Subject: clean up webhook code a bit --- contrib/wallet-core | 2 +- src/backend/taler-merchant-webhook.c | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/contrib/wallet-core b/contrib/wallet-core index 0c211082..a675c940 160000 --- a/contrib/wallet-core +++ b/contrib/wallet-core @@ -1 +1 @@ -Subproject commit 0c211082e0b8372f8fa1cef8102e477c7363d9ba +Subproject commit a675c94085cfa90052c9ebacd2cebccfab2c4f18 diff --git a/src/backend/taler-merchant-webhook.c b/src/backend/taler-merchant-webhook.c index 99ab76d5..60ad3240 100644 --- a/src/backend/taler-merchant-webhook.c +++ b/src/backend/taler-merchant-webhook.c @@ -467,20 +467,9 @@ select_work (void *cls) return; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: /* wait 5 min */ + /* Note: this should not even be necessary if all webhooks + use the events properly... */ rel = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); - if (NULL == eh) - { - struct GNUNET_DB_EventHeaderP es = { - .size = htons (sizeof (es)), - .type = htons (TALER_DBEVENT_MERCHANT_WEBHOOK_PENDING) - }; - - eh = db_plugin->event_listen (db_plugin->cls, - &es, - GNUNET_TIME_UNIT_FOREVER_REL, - &db_notify, - NULL); - } task = GNUNET_SCHEDULER_add_delayed (rel, &select_work, NULL); @@ -493,7 +482,7 @@ select_work (void *cls) } -/* +/** * First task. * * @param cls closure, NULL @@ -538,6 +527,18 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } + { + struct GNUNET_DB_EventHeaderP es = { + .size = htons (sizeof (es)), + .type = htons (TALER_DBEVENT_MERCHANT_WEBHOOK_PENDING) + }; + + eh = db_plugin->event_listen (db_plugin->cls, + &es, + GNUNET_TIME_UNIT_FOREVER_REL, + &db_notify, + NULL); + } GNUNET_assert (NULL == task); task = GNUNET_SCHEDULER_add_now (&select_work, NULL); -- cgit v1.2.3