Skip to content

Commit

Permalink
more try / catch (#8016)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasfj committed Sep 4, 2024
1 parent 28a731d commit 976ab5b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/lib/task/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,21 @@ class TaskBackend {
while (!aborted.isCompleted) {
// Acquire the global lock and scan for package changes while lock is
// valid.
await lock.withClaim((claim) async {
await _scanForPackageUpdates(claim, abort: aborted);
}, abort: aborted);
try {
await lock.withClaim((claim) async {
await _scanForPackageUpdates(claim, abort: aborted);
}, abort: aborted);
} catch (e, st) {
// Log this as very bad, and then move on. Nothing good can come
// from straight up stopping.
_log.shout(
'scanning failed (will retry when lock becomes free)',
e,
st,
);
// Sleep 5 minutes to reduce risk of degenerate behavior
await Future.delayed(Duration(minutes: 5));
}
}
} catch (e, st) {
_log.severe('scanning loop crashed', e, st);
Expand Down Expand Up @@ -159,6 +171,8 @@ class TaskBackend {
e,
st,
);
// Sleep 5 minutes to reduce risk of degenerate behavior
await Future.delayed(Duration(minutes: 5));
}
}
} catch (e, st) {
Expand Down

0 comments on commit 976ab5b

Please sign in to comment.