detect exiting in proper loop

This commit is contained in:
fuwa
2019-07-25 01:54:47 +00:00
parent 65b4f0ce9b
commit 6536d135e3
+10 -7
View File
@@ -235,13 +235,6 @@ class SyncedState extends HookedState {
await for (final line in processOutput) {
if (!synced) break;
if (isExiting()) {
ExitingState _next = ExitingState
(
setState, getNotification, stdout, processOutput
);
return moveState(_next);
}
// print('synced: print stdout loop');
stdout.addLast(line);
log.info(line);
@@ -252,6 +245,16 @@ class SyncedState extends HookedState {
Future<void> checkSync() async {
await for (final _null in refresh.pull(getNotification, 'syncedState')) {
if (isExiting()) {
log.fine('Synced state detected exiting');
ExitingState _next = ExitingState
(
setState, getNotification, stdout, processOutput
);
return moveState(_next);
}
if (await daemon.isNotSynced()) {
synced = false;
break;