Skip to content

Commit

Permalink
engine: disable coroutines when invoking custom events.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <phillip.whelan@chronosphere.io>
  • Loading branch information
pwhelan committed Sep 3, 2024
1 parent 0627a6f commit 18653cc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ int flb_engine_start(struct flb_config *config)
struct flb_bucket_queue *evl_bktq;
struct flb_sched *sched;
struct flb_net_dns dns_ctx;
struct flb_coro *prev_coro = NULL;

/* Initialize the networking layer */
flb_net_lib_init();
Expand Down Expand Up @@ -1038,7 +1039,14 @@ int flb_engine_start(struct flb_config *config)
flb_coro_resume(output_flush->coro);
}
else if (event->type == FLB_ENGINE_EV_CUSTOM) {
prev_coro = flb_coro_get();
if (prev_coro) {
flb_coro_set(NULL);
}
event->handler(event);
if (prev_coro) {
flb_coro_set(prev_coro);
}
}
else if (event->type == FLB_ENGINE_EV_THREAD) {
struct flb_connection *connection;
Expand Down

0 comments on commit 18653cc

Please sign in to comment.