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

Use pending file during save #311

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

stefanhahmann
Copy link
Collaborator

Resolves #310

The goal of this PR is to ensure that the actual project file is only overwritten, when the saving process was successful and not interrupted

  • Strategy to achieve this:
    • When saving the mastodon project file, it is first saved to projectname.mastodon_pending
    • When saving to this file was successful, projectname.mastodon gets overwritten with projectname.mastodon_pending

Motivation for this:

  • In the past, it has been observed that *.mastodon files were corrupted and could not be read anymore
  • Typical saving times for a project range from ~0.2s to ~2s (depending on project size, attributes, etc.). Not very long, but long enough to kill mastodon during the saving process

@stefanhahmann stefanhahmann self-assigned this Jun 7, 2024
@stefanhahmann stefanhahmann requested a review from tinevez June 7, 2024 12:04
@stefanhahmann stefanhahmann removed the request for review from tinevez June 10, 2024 09:41
@stefanhahmann stefanhahmann force-pushed the use-pending-file-during-save branch 2 times, most recently from df0a011 to 81537f5 Compare June 10, 2024 10:49
@stefanhahmann stefanhahmann requested a review from tinevez June 10, 2024 10:55
@stefanhahmann stefanhahmann force-pushed the use-pending-file-during-save branch from 81537f5 to 3b739e6 Compare June 10, 2024 13:53
…rocess was successful and not interrupted

* Strategy to achieve this:
 * When saving the mastodon project files, they are first saved to projectfile.mastodon_pending (in the zip file case) or projectfolder_pending (in the directory case)
 * When saving was successful, projectfile.mastodon gets overwritten with projectfile.mastodon_pending (in the zip file case) or projectfolder get overwritten with projectfolder_pending (in the directory case)
 * In the past, it has been observed that *.mastodon files were corrupted and could not be read anymore
 * Typical saving times for a project range from ~0.2s to ~2s (depending on project size, attributes, etc.). Not very long, but long enough to kill mastodon during the saving process.
* Saving/Loading Projects in Mastodon is currently not possible in a headless way
* To be able to run e.g. unit tests in a headless environment a display needs to be simulated
* tests saving a project to a zip file and a directory
@stefanhahmann stefanhahmann force-pushed the use-pending-file-during-save branch from 3b739e6 to 73cfce4 Compare June 26, 2024 09:54
@tinevez tinevez merged commit 425c372 into mastodon-sc:dev Jun 26, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants