-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Maintain autosave timers while disconnected #16903
Conversation
Thanks for making a pull request to jupyterlab! |
Sounds sensible! Would you be able to add a test that fails before the fix and passes after to the following test suite? jupyterlab/packages/docmanager/test/savehandler.spec.ts Lines 45 to 210 in 9cc6267
|
Added a test. |
@krassowski All tests are now passing. OK to merge and backport to 4.3.x? |
This should get backported further back than 4.3.x, no? |
We typically only backport changes further upon request. @kellyrowland How far back should we backport this fix once it's been merged into main? |
Ideally as far back as the version where the bug was introduced, but I would settle for 4.2.x 🙂 |
jest | ||
.spyOn(handler as any, '_isConnectedCallback') | ||
.mockReturnValue(false); | ||
jest.spyOn(handler as any, '_setTimer'); | ||
jest.spyOn(handler as any, '_save'); | ||
|
||
handler.saveInterval = 120; | ||
handler.start(); | ||
jest.advanceTimersByTime(120000); // in ms | ||
expect((handler as any)._setTimer).toHaveBeenCalledTimes(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally tests should interface with the public API rather than private implementation details, as the implementation may change more rapidly and the test will need modifying (or worse would get deleted). That said I do not want to hold this off so if anyone else is happy to approve as-is I will not block it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - I've revised the test.
BTW, while poking around the docmanager tests, I found one that wasn't really testing anything and fixed it in #16933. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @holzman!
@meeseeksdev please backport to 4.3.x |
Co-authored-by: Burt Holzman <burt@fnal.gov>
Co-authored-by: Burt Holzman <burt@fnal.gov>
Is there an ETA for when these backports will get a release? We'd really like to get the fix out to our users. |
@jupyterlab/release Per comment above, is now an appropriate time to cut new 4.2.x and 4.3.x releases to include backports of this fix? |
@JasonWeill sure, if you would like to cut the releases please feel free to do so! I think @krassowski mentioned somewhere that he wanted to make a |
Yes 4.3.x is on the menu today. Not sure if 4.2.x is ready to go I will let @JasonWeill make the call. |
As of today it looks like this would be the only user-facing change on 4.2.6: v4.2.5...4.2.x. |
@kellyrowland Version 4.2.6 is now available, which includes this change: https://github.com/jupyterlab/jupyterlab/releases/tag/v4.2.6 |
Thank you! |
v4.3.1 is now also released, and that also includes this fix. Thank you @krassowski ! |
References
Fixes #16798.
Code changes
The autosave feature works by starting a timer. When the timer expires, it clears itself; then, if the session is connected, it attempts a save (which then restarts the timer for the next save). However, if the session is disconnected, the timer never gets restarted - this code just calls
_setTimer()
in that case.User-facing changes
Backwards-incompatible changes