-
Notifications
You must be signed in to change notification settings - Fork 898
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
Replace single config.json with a buffer of files #1
Replace single config.json with a buffer of files #1
Conversation
This makes it so that we never have to rename a config.json.bak file over the current config.json file. This also reduces the chance of file writing collusion. This is to prevent corrupt config.json files
|
||
const files = getSortedTimestampedFilesSync(filepath, basename, extension); | ||
|
||
while (files.length > 10) { |
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.
this hardcoded 10
is the number of config.timestamp.json files to keep. we may want to put this in a variable instead of inline hardcode. we may also might want this to be configurable? /shrug
I figured 10 would be enough when I wrote this; I haven't ran into a case when all 10 are corrupt
Is this waiting on anything @bengotow? |
FYI nylas-mail-lives/nylas-mail#134 and nylas-mail-lives/nylas-mail#141 are further implementations on top of this PR |
Hey! Awesome thanks—I haven't merged this yet because if it's possible, I'd rather figure out why the config.json file is becoming corrupt in the first place and fix that. (Doing an atomic write + replace should be safe, especially now that all the writes are done from the main process and not from each window separately.) So far there haven't been any reports of corrupt config.json files in the Mailspring fork, though it might just be that |
I'm fairly certain it's due to several applications are making changes several times a minute to the same file. My best guess is you won't see this problem due to the different sync process. I'm going to close this PR for now |
This pull request has been mentioned on Mailspring Community. There might be relevant details there: https://community.getmailspring.com/t/mailspring-shows-wrong-subject/640/1 |
bump electron 12.2.3
This makes it so that we never have to rename a config.json.bak file over the current config.json file. This also reduces the chance of file writing collusion. This is to prevent corrupt config.json files
See nylas-mail-lives/nylas-mail#15 and nylas/nylas-mail#3382