-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up boot time #942
Speed up boot time #942
Conversation
Similar as OpenCollarTeam#732: oc_states changes to speed up boot time. Difference this time: * keeping the settings editor in oc_states * no longer requiring ALIVE from oc_settings Additionally, the settings editor reads and saves the settings directly from LinksetData (since it's been added in setting OpenCollarTeam#941) The boot sequence goes through 3 stages. * First state a REBOOT signal is send and waits for ALIVE from oc_core and oc_api. And also check if oc_settings is running * In the 2e state the STARTUP signal is sent and waits for replies * Entering the final state oc_state sends out the TIMEOUT_READY signal.
The button wasn't getting added because the MENUNAME_REQUEST was caught to late in the script. This should fix that.
Nice work. Pending final decisions on settings namespace. LSD will get used for things we don't want to expose to the settings editor, so this will take some thought and planning - the tokens accepted into the editor should be limited by prefix. I'm rather hoping that the LSD changes are going to make it easier for us to skip the boot process altogether, but we'll see. |
Removing LinksetData dependency so it hopefully can be used in 8.3
Seeing how 9.x is probably far of, I figured I remove the LSD dependencies for now. Please check if it can be merged with 8.3 now. |
@Yosty7B3 I've taken a good look at this now (sorry it has taken so long to test it thoroughly!) I like the way you've approached this and with this change a collar will start reacting properly in about 6-7 seconds while 8.2.3 takes 14-15 seconds. If my guess is right about the cause here, this should be fixable by putting in a delay after receiving an ALIVE signal before sending an INITIALIZE signal rather than sending one per ALIVE. I think it should be practical via your methods to get the collar to a stable boot up in around 20 seconds, which people will appreciate. However as we will be simplifying the boot process significantly for 9.x there's a question of how much effort it would take you to refine this if it turns out to be more intractable than my guess, though I'd hate the work you've done to be wasted. One final side point: when doing PRs, can we please focus on one thing at a time. This particularly in the case of reformatting. Your version of the script is much more user-friendly keeping the global variables all at the top rather than mixed in with the functions, but it makes it a lot harder to do a code review. That kind of reformatting should be done as a separate PR first without any code changes at the same time, because otherwise the diffs are kind of a nightmare. Thanks for your excellent work on this so far. |
Hmmm yes. For some reason this didn't happen to me but using a fresh collar and only changing oc_states I saw it too now.
I can probably remove that whole part. I don't remember exactly what my thinking was but I assume it was intended as a failsafe in case a single script got restarted. |
@Yosty7B3 The initialize message ensures that scripts assert menus and request settings as necessary. I think in the original oc_states the idea was that if a script starts late and sends its ALIVE message after the initialize message has been sent, oc_states will resend initialize to ensure everything's synced up. Ideally the initialize message would be sent once all scripts have reported ALIVE, but that would suspend the boot process if any script exists that for whatever reason doesn't send an ALIVE message -- a 3rd party texture script or something. If the initialize is not sent immediately an ALIVE message is received but rather that sets a flag to fire initialize on the next timer tick as long as say 5 seconds has passed since the last ALIVE message was received (and probably shorten the timer tick) that should resolve it. |
Yea, initialize does trigger the menu update. So I guess it should stay in then. |
"initialize" was being spammed on every script that sent an ALIVE signal, and "STARTUP ALL" was being send before oc_api was even alive. Changed it so that STARTUP and initialize are only send once.
Similar as #732: oc_states changes to speed up boot time.
Difference this time:
The boot sequence goes through 3 stages.