engine: fix the out-of-order issue when there is task retry in non-multiplex mode
this fix ensures that in non-multiplexing mode, if a task is in the retry state, the tasks behind it in the queue will not be started.
@@ -129,6 +129,7 @@ static int tasks_start(struct flb_input_instance *in,
struct flb_config *config)
{
int hits = 0;
+ int retry = 0;
struct mk_list *tmp;
struct mk_list *head;
struct mk_list *r_head;
@@ -142,6 +143,10 @@ static int tasks_start(struct flb_input_instance *in,
mk_list_foreach_safe(head, tmp, &in->tasks) {
task = mk_list_entry(head, struct flb_task, _head);
+ if (mk_list_is_empty(&task->retries) != 0) {
+ retry++;
+ }
+
/* Only process recently created tasks */
if (task->status != FLB_TASK_NEW) {
continue;
@@ -176,7 +181,8 @@ static int tasks_start(struct flb_input_instance *in,
* running something.
*/
if (out->flags & FLB_OUTPUT_NO_MULTIPLEX) {
- if (mk_list_size(&route->out->th_queue) > 0) {
+ if (mk_list_size(&route->out->th_queue) > 0 ||
+ retry > 0) {
continue;
}
}
