Skip to content

Commit deabeac

Browse files
committed
Use longer overlaps every 6-hours.
1 parent 28a731d commit deabeac

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/lib/task/backend.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ class TaskBackend {
289289
// Map from package to updated that has been seen.
290290
final seen = <String, DateTime>{};
291291

292+
// We will schedule longer overlaps every 6 hours.
293+
var nextLongScan = clock.fromNow(hours: 6);
294+
292295
// In theory 30 minutes overlap should be enough. In practice we should
293296
// allow an ample room for missed windows, and 3 days seems to be large enough.
294297
var since = clock.ago(days: 3);
@@ -298,8 +301,14 @@ class TaskBackend {
298301
..filter('updated >', since)
299302
..order('-updated');
300303

301-
// Next time we'll only consider changes since now - 5 minutes
302-
since = clock.ago(minutes: 5);
304+
if (clock.now().isAfter(nextLongScan)) {
305+
// Next time we'll do a longer scan
306+
since = clock.ago(days: 1);
307+
nextLongScan = clock.fromNow(hours: 6);
308+
} else {
309+
// Next time we'll only consider changes since now - 30 minutes
310+
since = clock.ago(minutes: 30);
311+
}
303312

304313
// Look at all packages that has changed
305314
await for (final p in q.run()) {

0 commit comments

Comments
 (0)