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:
@@ -126,7 +126,7 @@ static void raw_export_report_progress(RawExport *e) {
|
||||
if (percent == e->last_percent)
|
||||
return;
|
||||
|
||||
if (!ratelimit_test(&e->progress_rate_limit))
|
||||
if (!ratelimit_below(&e->progress_rate_limit))
|
||||
return;
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
||||
@@ -134,7 +134,7 @@ static void tar_export_report_progress(TarExport *e) {
|
||||
if (percent == e->last_percent)
|
||||
return;
|
||||
|
||||
if (!ratelimit_test(&e->progress_rate_limit))
|
||||
if (!ratelimit_below(&e->progress_rate_limit))
|
||||
return;
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
||||
@@ -149,7 +149,7 @@ static void raw_import_report_progress(RawImport *i) {
|
||||
if (percent == i->last_percent)
|
||||
return;
|
||||
|
||||
if (!ratelimit_test(&i->progress_rate_limit))
|
||||
if (!ratelimit_below(&i->progress_rate_limit))
|
||||
return;
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
||||
@@ -156,7 +156,7 @@ static void tar_import_report_progress(TarImport *i) {
|
||||
if (percent == i->last_percent)
|
||||
return;
|
||||
|
||||
if (!ratelimit_test(&i->progress_rate_limit))
|
||||
if (!ratelimit_below(&i->progress_rate_limit))
|
||||
return;
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
||||
Reference in New Issue
Block a user