diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-01-05 16:17:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-01-05 16:17:38 +0100 |
commit | 026de1dda4cffbb973a2192a017974a487907a37 (patch) | |
tree | 2e998b18412ce942b7c33821a5ceb4d5d47b2610 | |
parent | 99cc6c2e5e6b7238e26ff1f5524432c999054ad7 (diff) |
clean up webhook code a bit
m--------- | contrib/wallet-core | 0 | ||||
-rw-r--r-- | src/backend/taler-merchant-webhook.c | 29 |
2 files changed, 15 insertions, 14 deletions
diff --git a/contrib/wallet-core b/contrib/wallet-core -Subproject 0c211082e0b8372f8fa1cef8102e477c7363d9b +Subproject a675c94085cfa90052c9ebacd2cebccfab2c4f1 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); |