summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-06 22:17:14 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-06 22:17:14 +0100
commit6e8e437885422a42537761f8b7ca58844af71094 (patch)
tree5adca05cf594761e5cbaa774623c95863add0584 /src/backend
parentf77c265753f878386f374ea05b5f170c728b866f (diff)
downloadmerchant-6e8e437885422a42537761f8b7ca58844af71094.tar.gz
merchant-6e8e437885422a42537761f8b7ca58844af71094.tar.bz2
merchant-6e8e437885422a42537761f8b7ca58844af71094.zip
-fix child management
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-depositcheck.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/backend/taler-merchant-depositcheck.c b/src/backend/taler-merchant-depositcheck.c
index 6981ebe0..7bf8a61c 100644
--- a/src/backend/taler-merchant-depositcheck.c
+++ b/src/backend/taler-merchant-depositcheck.c
@@ -199,7 +199,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Name of the configuration file we use.
*/
-static const char *cfg_filename;
+static char *cfg_filename;
/**
* Our database plugin.
@@ -613,11 +613,17 @@ static void
select_work (void *cls)
{
bool retry = false;
- uint32_t limit = CONCURRENCY_LIMIT - w_count;
+ uint64_t limit = CONCURRENCY_LIMIT - w_count;
(void) cls;
task = NULL;
+ GNUNET_assert (w_count <= CONCURRENCY_LIMIT);
GNUNET_assert (NULL != keys);
+ if (0 == limit)
+ {
+ GNUNET_break (0);
+ return;
+ }
if (GNUNET_TIME_absolute_is_past (keys->key_data_expiration.abs_time))
{
/* Parent should re-start us, then we will re-fetch /keys */
@@ -706,15 +712,19 @@ static struct GNUNET_OS_Process *
start_worker (const char *base_url)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Launching worker for exchange `%s'\n",
- base_url);
+ "Launching worker for exchange `%s' using `%s`\n",
+ base_url,
+ cfg_filename);
return GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
NULL,
NULL,
NULL,
"taler-merchant-depositcheck",
+ "taler-merchant-depositcheck",
"-c", cfg_filename,
"-e", base_url,
+ "-L", "INFO",
+ test_mode ? "-t" : NULL,
NULL);
}
@@ -756,6 +766,12 @@ child_done_cb (void *cls,
return;
}
GNUNET_OS_process_destroy (c->process);
+ c->process = NULL;
+ if (test_mode &&
+ (! GNUNET_TIME_relative_is_zero (c->rd)) )
+ {
+ return;
+ }
if (GNUNET_TIME_absolute_is_future (c->next_start))
c->rd = GNUNET_TIME_STD_BACKOFF (c->rd);
else
@@ -850,7 +866,10 @@ run (void *cls,
(void) args;
cfg = c;
- cfg_filename = cfgfile;
+ cfg_filename = GNUNET_strdup (cfgfile);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Running with configuration %s\n",
+ cfgfile);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
if (NULL == exchange_url)