The till stays awake while it trades, and catches up the moment it wakes - #779
Merged
Merged
Conversation
Owner: "desktop app system got logged out or screen lock, then also our app should keep wake." Stage 7 of the print roadmap, and the one failure that needs no queue to hurt. WHAT WAS HAPPENING Windows sleeps an idle machine, and a restaurant till is idle for long stretches between services. The moment it suspends the kitchen stops receiving tickets and handsets stop reaching it - while the screen still says Posnic and nothing reports a fault. The waiter presses send, the phone says sent, and no paper comes out. Nobody finds out until somebody walks to the printer. THE DISTINCTION THAT MATTERS Locking is not sleeping. A locked Windows session keeps running everything and keeps printing, so locking a till is fine and worth encouraging; LOGGING OUT ends the session and is the thing that kills it. Conflating the two sends a shop hunting the wrong fault, so a lock is logged saying exactly that. WHAT IS HELD, AND WHAT IS NOT prevent-app-suspension, never prevent-display-sleep. The system is kept from suspending; the screen may still blank, and should - a kitchen display that can never blank is one that burns in. The block is released on shutdown, because a till that looks switched off and still refuses to sleep is a machine nobody can explain. THE WAKE-UP IS WHERE DUPLICATES COME FROM A till asleep for two hours wakes with work behind it and a thirty second poll that did not run while it was suspended. Thirty seconds at a pass with no ticket is how a cook reprints by hand, and that is how a wake-up becomes the duplicate this whole area exists to prevent. So every collector runs on resume rather than at the next timer: kitchen tickets, floor bills, and cloud-relayed bills. One failing task cannot stop the others - the point of the moment is that everything catches up at once - and a rejected promise is caught, because an unhandled rejection on a till is a crash dialog in a restaurant. Nothing here can stop a till starting. powerSaveBlocker is genuinely absent under some remote sessions, so every call answers instead of throwing, and the startup call sits inside a try. Desktop 2530 pass.
#777 added src/handset-slots.js and this one added src/till-stays-awake.js, at the same line of build.files. Both ship. Nothing else disagreed. build.files is an explicit allowlist, so a file left out of it is simply absent from the installed app - the module resolves in development and is missing on a shop's machine. Worth resolving by keeping both rather than by taking a side.
Contributor
|
Merged to Try it at https://develop.posnic.io, or run it yourself: git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev # then http://localhost:3000When you have tested it, say what you did and what happened, and set Reporting that something is broken is as useful as fixing it. It is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 7 of the print roadmap. The one failure that needs no queue to hurt.
What was happening
Windows sleeps an idle machine, and a restaurant till is idle for long stretches
between services. The moment it suspends, the kitchen stops receiving tickets
and handsets stop reaching it — while the screen still says Posnic and nothing
reports a fault. The waiter presses send, the phone says sent, no paper comes
out. Nobody finds out until somebody walks to the printer.
Locking is not sleeping
Worth being exact, because the two get conflated and it sends a shop hunting the
wrong fault:
A lock is logged saying the till kept running, so "it stopped when I locked it"
has an answer in the log rather than a shrug.
What is held, and what is not
prevent-app-suspension, neverprevent-display-sleep. The system is keptfrom suspending; the screen may still blank, and should — a kitchen display that
can never blank is one that burns in.
The block is released on shutdown. A till that looks switched off and still
refuses to sleep is a machine nobody can explain.
The wake-up is where duplicates come from
A till asleep for two hours wakes with work behind it and a 30-second poll that
did not run while it was suspended. Thirty seconds at a pass with no ticket is
how a cook reprints by hand — and that is how a wake-up becomes the duplicate
this whole area exists to prevent.
So every collector runs on
resumerather than at the next timer:One failing task cannot stop the others — the point of the moment is that
everything catches up at once — and a rejected promise is caught, because an
unhandled rejection on a till is a crash dialog in a restaurant.
It cannot stop a till starting
powerSaveBlockeris genuinely absent under some remote sessions, so every callanswers instead of throwing, the module loads with no Electron at all, and the
startup call sits inside a
try. A test pins each of those.Desktop 2530 pass / 0 fail.
Next in this run
needs_attentionon the print queue, then kitchen tickets through the queueitself — shadowed alongside the existing poll, not swapped.