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:
+3
-3
@@ -1695,7 +1695,7 @@ void unit_status_emit_starting_stopping_reloading(Unit *u, JobType t) {
|
||||
int unit_start_limit_test(Unit *u) {
|
||||
assert(u);
|
||||
|
||||
if (ratelimit_test(&u->start_limit)) {
|
||||
if (ratelimit_below(&u->start_limit)) {
|
||||
u->start_limit_hit = false;
|
||||
return 0;
|
||||
}
|
||||
@@ -1988,7 +1988,7 @@ static void unit_check_unneeded(Unit *u) {
|
||||
/* If stopping a unit fails continuously we might enter a stop
|
||||
* loop here, hence stop acting on the service being
|
||||
* unnecessary after a while. */
|
||||
if (!ratelimit_test(&u->auto_stop_ratelimit)) {
|
||||
if (!ratelimit_below(&u->auto_stop_ratelimit)) {
|
||||
log_unit_warning(u, "Unit not needed anymore, but not stopping since we tried this too often recently.");
|
||||
return;
|
||||
}
|
||||
@@ -2038,7 +2038,7 @@ static void unit_check_binds_to(Unit *u) {
|
||||
/* If stopping a unit fails continuously we might enter a stop
|
||||
* loop here, hence stop acting on the service being
|
||||
* unnecessary after a while. */
|
||||
if (!ratelimit_test(&u->auto_stop_ratelimit)) {
|
||||
if (!ratelimit_below(&u->auto_stop_ratelimit)) {
|
||||
log_unit_warning(u, "Unit is bound to inactive unit %s, but not stopping since we tried this too often recently.", other->id);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user