-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Shutdown previus AutosaveManager and BackupManager during SaveAs #2994
Conversation
Hi @mpele Thanks for your take on this! Unfortunately, the current version will not do. If you shutdown the AutoSaveManager and the BackupManager, then there won't be any autosaves or backups anymore and this is not what we want here. As far as I can see, the way to go would be the following:
|
@lenhard, as I tested it works. After SaveAs new .sav file is created (AutosaveManager and BackupManager are restarted later in lines 351 and 356). |
I see, my bad! It sure makes sense to disable the two managers for the old file location. But the problem that remains is what if the save operation fails? Then, autosave and backup will no longer work for the old file. I still think it would be better to have a cleanup phase after the safe operation has been successful, i.e., shutting done the obsolete managers and removing any unnecessary files. |
Hi @lenhard, |
I've gone through #2947 and the code seems to solve the problem: The sav file is gone and the user is no longer asked if he wants to restore a backup when opening the old file. On looking at the code of BackupManager and AutosaveManager, I am a little unsure why we restart them to begin with, but that is not your problem here. So from my side the code is good to go. We have the policy that two of the developers need to review every pull request before it is merged. So could somebody else from @JabRef/developers have a look at this? |
@@ -316,7 +316,8 @@ public void saveAs() throws Exception { | |||
*/ | |||
public void saveAs(File file) throws Exception { | |||
BibDatabaseContext context = panel.getBibDatabaseContext(); | |||
|
|||
Path oldFile = context.getDatabasePath().get(); |
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.
Not your fault: I always wondered why this is an Optional, I think in this case I see no reason why it could be empty, so you are probably on the save side calling directly get.
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.
I think you don't have a database path if the library comes from a SQL server.
CHANGELOG.md
Outdated
@@ -29,6 +29,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# | |||
- We improved the duplicate checker such that different editions of the same publication are not marked as duplicates. [2960](https://github.com/JabRef/jabref/issues/2960) | |||
|
|||
### Fixed | |||
- We fixed the a bug that leaves .sav file after SaveAs [#2947] |
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.
A little typo: fixed a bug and please inlcude the URL behind like we do with other entries
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.
From my point of view it looks good. Just a little improvement in the changelog, but we can add this on merge.
* upstream/master: (30 commits) Add preference migration for keybdingings (#3007) Shutdown previus AutosaveManager and BackupManager during SaveAs (#2994) Run Checkstyle task after Test task (#3010) Mark LibraryOfCongressTest as a fetcher test (#3012) When browsing through the MainTable remember which EntryEditor tab was open (#3011) Improve performance of journal abbreviation loader (#3009) Update checkstyle 7.6.1 -> 8.0 Don't abort build when there are checkstyle violations (#3006) Reimplement content selectors (#3003) Only do a back up for bigger changes or if a different field is edited (#3004) Listen to change events for setting dirty status of database (#3001) Fix #2967: MathSciNet tab works again Fix #2902: Tab in entry editor moves to next text area Fix #2946: external changes are now correctly shown in the entry editor Fix #2998: improve auto completion (#3002) Fix mac keybinding by replacing ctrl it with meta key (#3000) Less backups (#2995) [WIP] Complete rework of the auto completion (#2965) Eclipse J Add switch indentation for Eclipse and add some new missing formatting options ...
* upstream/master: Add preference migration for keybdingings (#3007) Shutdown previus AutosaveManager and BackupManager during SaveAs (#2994) Run Checkstyle task after Test task (#3010) Mark LibraryOfCongressTest as a fetcher test (#3012) When browsing through the MainTable remember which EntryEditor tab was open (#3011) Improve performance of journal abbreviation loader (#3009) Update checkstyle 7.6.1 -> 8.0 Don't abort build when there are checkstyle violations (#3006) Reimplement content selectors (#3003) Only do a back up for bigger changes or if a different field is edited (#3004) Listen to change events for setting dirty status of database (#3001) Fix #2967: MathSciNet tab works again Fix #2902: Tab in entry editor moves to next text area Fix #2946: external changes are now correctly shown in the entry editor Fix #2998: improve auto completion (#3002) Fix mac keybinding by replacing ctrl it with meta key (#3000) Less backups (#2995) [WIP] Complete rework of the auto completion (#2965)
Hi,
Could anyone check is everything done correctly in this simple bug fix #2947.
gradle localizationUpdate
?