control stream-info requests rate (#19458)
Costa Tsaousis committed
Jan 22, 2025 at 08:55 UTC
2133107a15e744a40cc345db139ae03e3b5f285f
1 file changed
+6
-3
src/streaming/stream-parents.c
+6
-3
@@ -606,10 +606,12 @@ bool stream_parent_connect_to_one_unsafe(
606
case RRDHOST_INGEST_TYPE_VIRTUAL:
607
case RRDHOST_INGEST_TYPE_LOCALHOST:
608
d->reason = STREAM_HANDSHAKE_ERROR_LOCALHOST;
609
+ d->since_ut = now_ut;
610
+ d->postpone_until_ut = randomize_wait_ut(3600, 7200);
611
+
612
if(rrdhost_is_host_in_stream_path_before_us(host, d->remote.host_id, 1)) {
613
// we passed hops == 1, to make sure this succeeds only when the parent
614
// is the origin child of this node
612
- d->since_ut = now_ut;
615
d->banned_permanently = true;
616
skipped_not_useful++;
617
nd_log(NDLS_DAEMON, NDLP_INFO,
@@ -630,6 +632,8 @@ bool stream_parent_connect_to_one_unsafe(
632
switch(d->remote.ingest_status) {
633
case RRDHOST_INGEST_STATUS_INITIALIZING:
634
d->reason = STREAM_HANDSHAKE_INITIALIZATION;
635
+ d->since_ut = now_ut;
636
+ d->postpone_until_ut = randomize_wait_ut(30, 60);
637
skip = true;
638
break;
639
@@ -638,6 +642,7 @@ bool stream_parent_connect_to_one_unsafe(
642
d->reason = STREAM_HANDSHAKE_ERROR_ALREADY_CONNECTED;
643
if(rrdhost_is_host_in_stream_path_before_us(host, d->remote.host_id, host->sender->hops)) {
644
d->since_ut = now_ut;
645
+ d->postpone_until_ut = randomize_wait_ut(3600, 7200);
646
d->banned_for_this_session = true;
647
skipped_not_useful++;
648
nd_log(NDLS_DAEMON, NDLP_INFO,
@@ -645,8 +650,6 @@ bool stream_parent_connect_to_one_unsafe(
650
rrdhost_hostname(host), string2str(d->destination));
651
continue;
652
}
648
- else
649
- skip = true;
653
break;
654
655
default: