Skip to content

Commit a38a59d

Browse files
committed
required non-null now in _decay
1 parent 9a44dec commit a38a59d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/lib/shared/utils.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,9 @@ class DecayingMaxLatencyTracker {
320320
}) : _halfLifePeriod = halfLifePeriod ?? Duration(minutes: 1);
321321

322322
void _decay({
323-
required DateTime? now,
323+
required DateTime now,
324324
Duration? updateDelay,
325325
}) {
326-
now ??= clock.now();
327326
updateDelay ??= Duration.zero;
328327
final diff = now.difference(_lastUpdated);
329328
if (diff <= updateDelay) {
@@ -339,7 +338,10 @@ class DecayingMaxLatencyTracker {
339338
DateTime? now,
340339
Duration? updateDelay,
341340
}) {
342-
_decay(now: now, updateDelay: updateDelay ?? const Duration(seconds: 1));
341+
_decay(
342+
now: now ?? clock.now(),
343+
updateDelay: updateDelay ?? const Duration(seconds: 1),
344+
);
343345
return Duration(microseconds: _value);
344346
}
345347

0 commit comments

Comments
 (0)