diff --git a/src/flb_engine_dispatch.c b/src/flb_engine_dispatch.c index bbfd87abbb6..b161888e679 100644 --- a/src/flb_engine_dispatch.c +++ b/src/flb_engine_dispatch.c @@ -29,6 +29,7 @@ #include #include #include +#include /* It creates a new output thread using a 'Retry' context */ @@ -270,6 +271,14 @@ int flb_engine_dispatch(uint64_t id, struct flb_input_instance *in, continue; } + if (flb_task_map_get_task_id(config) == -1) { + /* + * There isn't a task available, no more chunks can have a task + * assigned. + */ + break; + } + /* There is a match, get the buffer */ buf_data = flb_input_chunk_flush(ic, &buf_size); if (buf_size == 0) { @@ -312,6 +321,12 @@ int flb_engine_dispatch(uint64_t id, struct flb_input_instance *in, */ if (t_err == FLB_TRUE) { flb_input_chunk_release_lock(ic); + + /* + * If the Storage type is 'filesystem' we need to put + * the file content down. + */ + flb_input_chunk_down(ic); } continue; }