Rename ratelimit_test to ratelimit_below
When I see "test", I have to think three times what the return value
means. With "below" this is immediately clear. ratelimit_below(&limit)
sounds almost like English and is imho immediately obvious.
(I also considered ratelimit_ok, but this strongly implies that being under the
limit is somehow better. Most of the times this is true, but then we use the
ratelimit to detect triple-c-a-d, and "ok" doesn't fit so well there.)
C.f. a1bcaa07.
This commit is contained in:
@@ -804,7 +804,7 @@ int manager_connect(Manager *m) {
|
||||
manager_disconnect(m);
|
||||
|
||||
m->event_retry = sd_event_source_unref(m->event_retry);
|
||||
if (!ratelimit_test(&m->ratelimit)) {
|
||||
if (!ratelimit_below(&m->ratelimit)) {
|
||||
log_debug("Slowing down attempts to contact servers.");
|
||||
|
||||
r = sd_event_add_time(m->event, &m->event_retry, clock_boottime_or_monotonic(), now(clock_boottime_or_monotonic()) + RETRY_USEC, 0, manager_retry_connect, m);
|
||||
|
||||
Reference in New Issue
Block a user