Repository navigation
Shut down and quit: offer another minute instead of only Force off - #149
Conversation
The same process can be waited on more than once (the quit flow is about to wait another minute at the user's request), and every timed-out wait left an 'exit' listener on the child process, which trips Node's max listeners warning after ten of them.
A minute after the power button press, any guest still running got a question with Force off and Cancel. A Windows guest installing updates on shutdown, or a Linux guest with a slow service, regularly needs longer than that, and Force off at that point loses the update. The question now offers Wait another minute, which is the default button, and says how long the app has been waiting. Cancel still stops the quit. The window goes back to the tray while it waits.
A21-devs
left a comment
There was a problem hiding this comment.
Read the whole diff. The loop is right as far as I can tell: waitForExit resolves true straight away for a VM that is no longer in running, so a guest that exits while the question is open drops out of waiting on the next round instead of being waited on for nothing, a per-VM Force off from the tray ends the wait the same way, and Cancel still leaves shuttingDown false with the tray menu rebuilt. The listener removal in waitForExit is the right call now that the same process is waited on repeatedly. One nit on the wording.
| detail: 'Force off loses anything unsaved inside the guest.', | ||
| buttons: ['Force off and quit', 'Cancel'], | ||
| cancelId: 1, | ||
| message: `${waiting.join(', ')} ${waiting.length === 1 ? 'has' : 'have'} not shut down ${minutes === 1 ? 'within a minute' : `in ${minutes} minutes`}.`, |
There was a problem hiding this comment.
Nit: minutes counts rounds of the question, not time, so it undercounts whenever the question sat unanswered for a while. Leave the dialog up for ten minutes, click Wait another minute, and the next one says "in 2 minutes" for a guest that has been shutting down for twelve. A Date.now() taken before the loop and rounded to minutes would read true in that case, and it is the same one line.
Also in the detail two lines down: "anything unsaved inside it" reads oddly when the message above named three VMs.
|
Fair nit, took both parts: the count now comes from a Rechecked: |
The question's minute count came from the number of rounds, so a question left open for a while made it read short. Take it from a timestamp instead, and make the detail line agree with the number of VMs named above it.
A21-devs
left a comment
There was a problem hiding this comment.
Second pass over 1ea94be. The nit is fixed both ways: minutes comes from since now, so time spent with the question open counts, and the detail line agrees with the number of VMs named. The Math.max(1, ...) floor keeps the first round reading "within a minute" even if the wait came back a few hundred milliseconds early, which is the case that would otherwise say "in 0 minutes".
One thing I looked at and am happy to leave: Math.round means 90 seconds reads as "in 2 minutes", slightly ahead of the real wait. Rounding to the nearest minute is how a person would say it, and the number is there to show the wait is getting long, not as a measurement, so it does not need to change.
Nothing else outstanding from either pass.
Closes #146
shutDownAllAndQuitgave every guest 60 seconds after the power button press and then asked Force off / Cancel. A Windows guest installing updates on shutdown regularly needs longer, and Force off there loses the update.The question now has three buttons: Wait another minute (the default), Force off and quit, Cancel. The wait and the question are a loop now, so it can be extended as often as needed, and the message says how long the app has been waiting ("has not shut down in 3 minutes"). While it waits, the window goes back to the tray, which already says the app quits once the VMs are off.
Picked the second option from the issue (no new setting): it needs no decision up front and the occasional slow shutdown is exactly when you find out you want it.
Also in here, because the loop makes it reachable:
VmRunner.waitForExitleft anexitlistener on the child process every time it timed out, so ten extra minutes of waiting would have printed Node's max listeners warning. It removes the listener now.Testing
npm run typecheck,npm test(153 pass),npm run buildnpm run test:qemu(170 pass, real headless VMs in a temp folder) since vmRunner changednpm run smoke: SMOKE OK