Skip to content

Commit

Permalink
in_calyptia_fleet: improved interval handling
Browse files Browse the repository at this point in the history
Signed-off-by: AdheipSingh <[email protected]>
  • Loading branch information
Jorge Niedbalski authored and AdheipSingh committed Dec 4, 2024
1 parent a95e92a commit 6ecb32f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,6 @@ static int in_calyptia_fleet_init(struct flb_input_instance *in,
ctx->collect_fd = -1;
ctx->fleet_id_found = FLB_FALSE;


/* Load the config map */
ret = flb_input_config_map_set(in, (void *) ctx);
if (ret == -1) {
Expand Down Expand Up @@ -2278,14 +2277,16 @@ static int in_calyptia_fleet_init(struct flb_input_instance *in,
return -1;
}

/* Log initial interval values */
flb_plg_debug(ctx->ins, "initial collector interval: sec=%d nsec=%d",
ctx->interval_sec, ctx->interval_nsec);

if (ctx->interval_sec <= 0 && ctx->interval_nsec <= 0) {
/* Illegal settings. Override them. */
ctx->interval_sec = atoi(DEFAULT_INTERVAL_SEC);
ctx->interval_nsec = atoi(DEFAULT_INTERVAL_NSEC);
}

if (ctx->interval_sec < atoi(DEFAULT_INTERVAL_SEC)) {
ctx->interval_sec = atoi(DEFAULT_INTERVAL_SEC);
flb_plg_info(ctx->ins, "invalid interval settings, using defaults: sec=%d nsec=%d",
ctx->interval_sec, ctx->interval_nsec);
}

/* Set the context */
Expand Down Expand Up @@ -2328,6 +2329,8 @@ static int in_calyptia_fleet_init(struct flb_input_instance *in,
}

ctx->collect_fd = ret;
flb_plg_info(ctx->ins, "fleet collector initialized with interval: %d sec %d nsec",
ctx->interval_sec, ctx->interval_nsec);

return 0;
}
Expand Down

0 comments on commit 6ecb32f

Please sign in to comment.