From 86c54696354ac54ca05c31a6a70baebefaac62a1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 18 Dec 2023 14:42:51 +0100 Subject: indexamajig: Add --asapo-consumer-timeout This also reduces the default timeout to 500 ms. --- doc/man/indexamajig.1.md | 4 ++++ src/im-asapo.c | 2 +- src/im-asapo.h | 1 + src/indexamajig.c | 11 +++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/man/indexamajig.1.md b/doc/man/indexamajig.1.md index 07620411..85566240 100644 --- a/doc/man/indexamajig.1.md +++ b/doc/man/indexamajig.1.md @@ -355,6 +355,10 @@ BASIC OPTIONS : only, but might be extended to other streaming systems in future. The : default is 60 seconds. +**--asapo-consumer-timeout** +: Set the timeout used for "get next" calls from ASAP::O, in ms. The default +: is 500 ms. + **--data-format=format** : Specify the data format for data received over ZeroMQ or ASAP::O. Possible : values in this version are msgpack, hdf5 and seedee. diff --git a/src/im-asapo.c b/src/im-asapo.c index 837c663c..d891dc1d 100644 --- a/src/im-asapo.c +++ b/src/im-asapo.c @@ -169,7 +169,7 @@ struct im_asapo *im_asapo_connect(struct im_asapo_params *params) if ( create_producer(a, params) ) return NULL; a->stream = strdup(params->stream); - asapo_consumer_set_timeout(a->consumer, 3000); + asapo_consumer_set_timeout(a->consumer, params->consumer_timeout_ms); a->group_id = asapo_string_from_c_str(params->group_id); a->wait_for_stream = params->wait_for_stream; diff --git a/src/im-asapo.h b/src/im-asapo.h index 43691700..424d8b59 100644 --- a/src/im-asapo.h +++ b/src/im-asapo.h @@ -44,6 +44,7 @@ struct im_asapo_params char *stream; int wait_for_stream; int write_output_stream; + int consumer_timeout_ms; }; struct im_asapo; diff --git a/src/indexamajig.c b/src/indexamajig.c index 361b761a..c3a7ac12 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -466,6 +466,14 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) } break; + case 225 : + if (sscanf(arg, "%d", &args->asapo_params.consumer_timeout_ms) != 1) + { + ERROR("Invalid value for --asapo-consumer-timeout\n"); + return EINVAL; + } + break; + /* ---------- Peak search ---------- */ case 't' : @@ -911,6 +919,7 @@ int main(int argc, char *argv[]) args.asapo_params.stream = NULL; args.asapo_params.wait_for_stream = 0; args.asapo_params.write_output_stream = 0; + args.asapo_params.consumer_timeout_ms = 500; args.cpu_pin = 0; args.serial_start = 1; args.if_peaks = 1; @@ -1040,6 +1049,8 @@ int main(int argc, char *argv[]) {"cpu-pin", 223, NULL, OPTION_NO_USAGE, "Pin worker processes to CPUs"}, {"no-data-timeout", 224, "s", OPTION_NO_USAGE, "Shut down after this many seconds without ASAP::O data"}, + {"asapo-consumer-timeout", 225, "ms", OPTION_NO_USAGE, + "ASAP::O get_next timeout for one frame (milliseconds)"}, {NULL, 0, 0, OPTION_DOC, "Peak search options:", 3}, {"peaks", 301, "method", 0, "Peak search method. Default: zaef"}, -- cgit v1.2.3