]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] upstream: improve cooldown log message clarity 6068/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 29 May 2026 13:43:56 +0000 (16:43 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 29 May 2026 13:43:56 +0000 (16:43 +0300)
When elapsed time rounded to the same value as the minimum interval,
the log showed "checked 60 seconds ago (60 is minimum)", suggesting
the check was skipped at equality despite the strict < comparison.
Replace with remaining cooldown time using ceil() to avoid ambiguity.

src/libutil/upstream.c

index 3f470bf8b7741086580addf100c761438d9baa05..7896d0cba82098d83b63556e7e318e9d20ad8d1c 100644 (file)
@@ -1452,11 +1452,12 @@ rspamd_upstream_resolve_addrs(const struct upstream_list *ls,
 
                double now = ev_now(upstream->ctx->event_loop);
 
-               if (now - upstream->last_resolve < upstream->ctx->limits.resolve_min_interval) {
-                       msg_info_upstream("do not resolve upstream %s as it was checked %.0f "
-                                                         "seconds ago (%.0f is minimum)",
-                                                         upstream->name, now - upstream->last_resolve,
-                                                         upstream->ctx->limits.resolve_min_interval);
+               double remaining = upstream->ctx->limits.resolve_min_interval -
+                                                  (now - upstream->last_resolve);
+               if (remaining > 0) {
+                       msg_info_upstream("do not resolve upstream %s: cooldown remains "
+                                                         "%.0f seconds",
+                                                         upstream->name, ceil(remaining));
 
                        return;
                }