question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saving/restoring machine state between runs

See original GitHub issue

Is there any better clear strategy of saving and restoring machine state between instances than saving state() and restoring with force_transition()?

I am currently using mentioned above methods, but the only drawback I see if that I do not save/restore any data besides states, and also force_transition() is causing entry hooks to fire up, which doesn’t make any sense as they have already been fired up in previous run.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
xtovskicommented, Jul 11, 2022

Yes, you are correct. I am re-binding all hooks in a state machine factory I made to do all serialization/de-serialization tasks.

1reaction
StoneCyphercommented, Jul 9, 2022

@xtovski - draft implementation available, please update. API should be stable.


const machine_string = "a 'next' <-> 'next' b;";

const foo = jssm.from(machine_string, { history: 5, data: 2 });

foo.do('next'); 
foo.do('next'); 
foo.do('next'); 

const ser = foo.serialize();

const bar = jssm.deserialize(machine_string, ser);
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I save an activity state using the save instance state?
You need to override onSaveInstanceState(Bundle savedInstanceState) and write the application state values you want to change to the Bundle parameter like ...
Read more >
US7308565B2 - Saving/restoring task state data from/to device ...
A save/restore module responsively stores task states from the host ... Saving/restoring task state data from/to device controller host interface upon ...
Read more >
Save UI states - Android Developers
Learn how to preserve your UI state across config changes. ... long-running serialization can cause dropped frames and visual stutter.
Read more >
11 Basic VM Guest management - SUSE Documentation
Changing a VM Guest's state can be done either from Virtual Machine Manager's main window, or from a VNC window. Procedure 11.1: State...
Read more >
SCR algorithm: Saving/restoring states of file systems
point to save the current running states of the program in the stable storage. When a fault occurs, check-pointing algorithms rerun the program...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found