engine: dispatch: check plugin multiplex setup
@@ -128,6 +128,7 @@ static void test_run_formatter(struct flb_config *config,
static int tasks_start(struct flb_input_instance *in,
struct flb_config *config)
{
+ int hits = 0;
struct mk_list *tmp;
struct mk_list *head;
struct mk_list *r_head;
@@ -170,6 +171,18 @@ static int tasks_start(struct flb_input_instance *in,
continue;
}
+ /*
+ * If the plugin don't allow multiplexing Tasks, check if it's
+ * running something.
+ */
+ if (out->flags & FLB_OUTPUT_NO_MULTIPLEX) {
+ if (mk_list_size(&route->out->th_queue) > 0) {
+ continue;
+ }
+ }
+
+ hits++;
+
/*
* We have the Task and the Route, created a thread context for the
* data handling.
@@ -184,6 +197,10 @@ static int tasks_start(struct flb_input_instance *in,
flb_task_add_thread(th, task);
flb_thread_resume(th);
}
+
+ if (hits == 0) {
+ task->status = FLB_TASK_NEW;
+ }
}
return 0;
