Skip to content

Commit

Permalink
upstream: detect shutdown and reduce log noise
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Nov 23, 2021
1 parent 8e1e565 commit fd1f909
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions include/fluent-bit/flb_upstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,16 @@ struct flb_upstream {
struct flb_tls *tls;
#endif

struct flb_config *config;
struct mk_list _head;
};


static inline int flb_upstream_is_shutting_down(struct flb_upstream *u)
{
return u->config->is_shutting_down;
}

void flb_upstream_queue_init(struct flb_upstream_queue *uq);
struct flb_upstream_queue *flb_upstream_queue_get(struct flb_upstream *u);
void flb_upstream_list_set(struct mk_list *list);
Expand Down
13 changes: 8 additions & 5 deletions src/flb_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ struct flb_upstream *flb_upstream_create(struct flb_config *config,
flb_errno();
return NULL;
}
u->config = config;

/* Set default networking setup values */
flb_net_setup_init(&u->net);
Expand Down Expand Up @@ -254,7 +255,6 @@ struct flb_upstream *flb_upstream_create(struct flb_config *config,
u->flags |= FLB_IO_ASYNC;
u->thread_safe = FLB_FALSE;


/* Initialize queues */
flb_upstream_queue_init(&u->queue);

Expand Down Expand Up @@ -795,10 +795,13 @@ int flb_upstream_conn_timeouts(struct mk_list *list)
u_conn->ts_connect_timeout > 0 &&
u_conn->ts_connect_timeout <= now) {
drop = FLB_TRUE;
flb_error("[upstream] connection #%i to %s:%i timed out after "
"%i seconds",
u_conn->fd,
u->tcp_host, u->tcp_port, u->net.connect_timeout);

if (!flb_upstream_is_shutting_down(u)) {
flb_error("[upstream] connection #%i to %s:%i timed out after "
"%i seconds",
u_conn->fd,
u->tcp_host, u->tcp_port, u->net.connect_timeout);
}
}

if (drop == FLB_TRUE) {
Expand Down

0 comments on commit fd1f909

Please sign in to comment.