Skip to content
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

[Bug]: Checkpoints folder is not deleted when Obsidian is closed #38

Closed
MaelImhof opened this issue Jun 15, 2024 · 2 comments · Fixed by #72
Closed

[Bug]: Checkpoints folder is not deleted when Obsidian is closed #38

MaelImhof opened this issue Jun 15, 2024 · 2 comments · Fixed by #72
Assignees
Labels
bug Something isn't working

Comments

@MaelImhof
Copy link
Owner

What's the issue?

When the Delete Jupyter checkpoints setting is enabled, checkpoints are put all together in one folder, in the plugin's directory. This folder is supposed to be deleted when Jupyter exits.

However, if the user closes Obsidian normally, the folder is never deleted. onunload is never called.

How to reproduce?

  1. Open the test vault
  2. Make sure Delete Jupyter checkpoints is enabled
  3. Open Welcome.ipynb
  4. Wait for some checkpoints to be created in .obsidian/plugins/jupyter/.ipynb_checkpoints
  5. Close Obsidian using the top-right (Windows) cross
  6. Checkpoints are still in .obsidian/plugins/jupyter/.ipynb_checkpoints

What have you tried?

Found out it was because onunload was never called on Obsidian exit, tried to find another hook but did not have any luck yet.

Additional information

Asked the question on Obsidian Forum, maybe some answer will come up there.

@MaelImhof MaelImhof added the bug Something isn't working label Jun 15, 2024
@MaelImhof MaelImhof assigned MaelImhof and unassigned MaelImhof Jun 15, 2024
@MaelImhof
Copy link
Owner Author

MaelImhof commented Jun 16, 2024

With the received answer (thank you joethei), try to implement a solution and see if it works for a normal use case (of course, if the user kills the Obsidian process, the clean up logic probably won't be executed, but check that it is executed if the user simply closes Obsidian normally).

  • Register a Workspace.on('quit') event that stops the server and basically unloads the plugin
  • Check whether the cleanup is executed on Obsidian close, and whether there are times when it is not

@MaelImhof MaelImhof self-assigned this Jun 16, 2024
@MaelImhof MaelImhof added this to the Release v1.0.0 milestone Jun 16, 2024
@MaelImhof MaelImhof linked a pull request Aug 3, 2024 that will close this issue
@MaelImhof MaelImhof added the ready label Aug 3, 2024
@MaelImhof
Copy link
Owner Author

Some best-effort cleanup has been implemented, but it cannot be certain that the plugin will be able to cleanup, as pointed out in joethei's answer, because some OS might kill Obsidian immediately and other weird shenanigans. Anyway, that's the best I can do.

This was referenced Aug 4, 2024
@MaelImhof MaelImhof removed the ready label Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant