From 21d3f1d8437d06091be21598797466e9649a4b44 Mon Sep 17 00:00:00 2001 From: Daniel Lenar Date: Mon, 21 Aug 2023 17:11:09 -0500 Subject: [PATCH] input: apply back pressure if input threaded plugin is paused Signed-off-by: Daniel Lenar --- src/flb_input_chunk.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/flb_input_chunk.c b/src/flb_input_chunk.c index 284a7f708e1..53ddb6c2905 100644 --- a/src/flb_input_chunk.c +++ b/src/flb_input_chunk.c @@ -1766,9 +1766,18 @@ void flb_input_chunk_ring_buffer_collector(struct flb_config *ctx, void *data) ins = mk_list_entry(head, struct flb_input_instance, _head); cr = NULL; - while ((ret = flb_ring_buffer_read(ins->rb, - (void *) &cr, - sizeof(cr))) == 0) { + while (1) { + if (flb_input_buf_paused(ins) == FLB_TRUE) { + break; + } + + ret = flb_ring_buffer_read(ins->rb, + (void *) &cr, + sizeof(cr)); + if (ret != 0) { + break; + } + if (cr) { if (cr->tag) { tag_len = flb_sds_len(cr->tag);