Skip to content

Commit 5faf65e

Browse files
committed
Fix client side reload race condition
There was a race condition between the bundle process and when we established the client watch set. We now store the future for the old bundle process so that it cannot be invalidated.
1 parent ff8498d commit 5faf65e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/run-app.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,18 @@ _.extend(AppRunner.prototype, {
611611
};
612612
}
613613

614-
// Establish a watcher on the new files.
615-
setupClientWatcher();
614+
var oldFuture = self.runFuture = new Future;
616615

617616
// Notify the server that new client assets have been added to the build.
618617
process.kill(appProcess.proc.pid, 'SIGUSR2');
618+
619+
// Establish a watcher on the new files.
620+
setupClientWatcher();
621+
619622
runLog.logClientRestart();
620623

621-
self.runFuture = new Future;
622-
ret = self.runFuture.wait();
624+
// Wait until another file changes.
625+
ret = oldFuture.wait();
623626
}
624627
} finally {
625628
self.runFuture = null;

0 commit comments

Comments
 (0)