Skip to content

Commit

Permalink
when worker becomes non-available, exit manager immediately to fail f…
Browse files Browse the repository at this point in the history
…ast #188
  • Loading branch information
fzyzcjy committed Jul 6, 2022
1 parent f3eeeaf commit 1ed7b00
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Future<void> main(List<String> args) async {
Log.i(_kTag, 'step awaitWorkerAvailable');
await _awaitWorkerAvailable();

unawaited(_monitorWorkerAvailable());

// to avoid #4575
Log.i(_kTag, 'step extra sleep to avoid too quickly hot-restart worker');
await Future<void>.delayed(const Duration(seconds: 6));
Expand Down Expand Up @@ -62,6 +64,24 @@ Future<void> _awaitWorkerAvailable() async {
}
}

Future<void> _monitorWorkerAvailable() async {
final vmServiceWrapperService = GetIt.I.get<VmServiceWrapperService>();

while (true) {
Log.i(_kTag, 'monitorWorkerAvailable check');
if (!vmServiceWrapperService.hotRestartAvailable) {
Log.e(
_kTag,
'monitorWorkerAvailable see hot restart not available, thus exit '
'(vmServiceWrapperService.hotRestartAvailable=${vmServiceWrapperService.hotRestartAvailable}, '
'vmServiceWrapperService.connected=${vmServiceWrapperService.connected})');
exit(1);
}

await Future<void>.delayed(const Duration(seconds: 5));
}
}

Future<void> _awaitSuiteInfoNonEmpty() async {
final suiteInfoStore = GetIt.I.get<SuiteInfoStore>();

Expand Down

0 comments on commit 1ed7b00

Please sign in to comment.