Skip to content

Commit

Permalink
sched: free the base timer used by the scheduler.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Jan 18, 2024
1 parent a0e5129 commit bfd93e4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int flb_sched_event_handler(struct flb_config *config, struct mk_event *event);
struct flb_sched *flb_sched_create(struct flb_config *config,
struct mk_event_loop *evl);

int flb_sched_destroy(struct flb_sched *sched);
int flb_sched_destroy(struct mk_event_loop *evl, struct flb_sched *sched);

struct flb_sched_timer *flb_sched_timer_create(struct flb_sched *sched);
int flb_sched_timer_destroy(struct flb_sched_timer *timer);
Expand Down
2 changes: 1 addition & 1 deletion src/flb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void flb_config_exit(struct flb_config *config)

/* Release scheduler */
if (config->sched) {
flb_sched_destroy(config->sched);
flb_sched_destroy(config->evl, config->sched);
}

#ifdef FLB_HAVE_HTTP_SERVER
Expand Down
2 changes: 1 addition & 1 deletion src/flb_input_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static void input_thread(void *data)

/* Create the bucket queue (FLB_ENGINE_PRIORITY_COUNT priorities) */
flb_bucket_queue_destroy(evl_bktq);
flb_sched_destroy(sched);
flb_sched_destroy(thi->evl, sched);
input_thread_instance_destroy(thi);
}

Expand Down
2 changes: 1 addition & 1 deletion src/flb_output_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static void output_thread(void *data)
flb_upstream_conn_active_destroy_list(&th_ins->upstreams);
flb_upstream_conn_pending_destroy_list(&th_ins->upstreams);

flb_sched_destroy(sched);
flb_sched_destroy(th_ins->evl, sched);
params = FLB_TLS_GET(out_flush_params);
if (params) {
flb_free(params);
Expand Down
3 changes: 2 additions & 1 deletion src/flb_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ struct flb_sched *flb_sched_create(struct flb_config *config,
}

/* Release all resources used by the Scheduler */
int flb_sched_destroy(struct flb_sched *sched)
int flb_sched_destroy(struct mk_event_loop *evl, struct flb_sched *sched)
{
int c = 0;
struct mk_list *tmp;
Expand Down Expand Up @@ -603,6 +603,7 @@ int flb_sched_destroy(struct flb_sched *sched)
/* Delete timers */
mk_list_foreach_safe(head, tmp, &sched->timers) {
timer = mk_list_entry(head, struct flb_sched_timer, _head);
mk_event_timeout_destroy(evl, &timer->event);
flb_sched_timer_destroy(timer);
c++;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/multiline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ static void test_issue_5504()
TEST_CHECK(ml->last_flush > last_flush);

/* Cleanup */
flb_sched_destroy(config->sched);
flb_sched_destroy(config->evl, config->sched);
config->sched = sched;
mk_event_loop_destroy(config->evl);
config->evl = evl;
Expand Down

0 comments on commit bfd93e4

Please sign in to comment.