Skip to content

Commit

Permalink
task: fix counter of running tasks, use 'users' counter (fluent#2411)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper authored and xmcqueen committed Oct 6, 2020
1 parent 33cf48e commit 196d9c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/flb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,18 @@ int flb_task_running_count(struct flb_config *config)
{
int count = 0;
struct mk_list *head;
struct mk_list *t_head;
struct flb_task *task;
struct flb_input_instance *ins;

mk_list_foreach(head, &config->inputs) {
ins = mk_list_entry(head, struct flb_input_instance, _head);
count += mk_list_size(&ins->tasks);
mk_list_foreach(t_head, &ins->tasks) {
task = mk_list_entry(t_head, struct flb_task, _head);
if (task->users > 0) {
count++;
}
}
}

return count;
Expand Down

0 comments on commit 196d9c0

Please sign in to comment.