This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
File Recovery Service #11828
Merged
Merged
File Recovery Service #11828
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ef3ab03
Emit {will,did}SavePath on `ipcMain` before/after a buffer is saved
049321a
:bug: :fire: Remove double subscription to the same buffer
de599f9
Make dialog asynchronous when a renderer process crashes
b58ce49
Create `FileRecoveryService` to restore corrupted files after a crash
770199c
:art: event.sender -> window
ca32c13
:fire: Unnecessary variable assignments
57195d7
:white_check_mark: Write specs for FileRecoveryService
97dd25d
:green_heart:
25fece4
:art: file-recovery-service-spec.js -> file-recovery-service.spec.js
858740c
:memo: Better description on spec
c7f4b33
Emit informative warning when a file can't be recovered
4f1efe6
:shirt: Fix linter errors
7a12984
:fire: Unused requires on specs
152c28a
Merge branch 'master' into as-file-recovery-service
e57b35f
Merge branch 'master' into as-file-recovery-service
b84feeb
Emit {will,did}SavePath events synchronously
3b4c101
Forget window when it gets closed
c8fae11
Handle recovery when many windows save the same file simultaneously
3ce7d0a
Merge branch 'master' into as-file-recovery-service
3030723
:shirt: Fix linting issues
a2a734a
Generate readable recovery filenames
c6a87b9
Add sinon
1a7858c
Log a more informative message when cannot recover a file
c2b01d5
Make coupling looser between the recovery service and the windows
8ba275a
:art: Move RecoveryFile down
49a603a
Show also a message box when recovery is not successful
3f8f3c9
:fire: Remove extra comma
8733b52
:fire: Extra imports
d8564ad
Be a little more defensive when retaining/releasing recovery files
aefcbcd
:fire: Remove unneeded WeakSet
6c34844
:bug: Don't try to recover the same file twice
df263a2
Return early when a recovery file can't be stored
5e0e65b
Merge branch 'master' into as-file-recovery-service
8355e7f
Use fs.copyFileSync for buffered copy
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
👕 Fix linter errors
- Loading branch information
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we ensure this is written by flushing? Granted this would only be a concern if the main process crashes...
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 am not sure about flushing, as I don't think it's enough to ensure the file was persisted. From
man 2 fsync
:So we might use
fcntl
but that wouldn't be cross-platform and I am not sure that investing time in flushing data to disk is actually worth it. What I like about this solution is that, worst-case scenario, users can find the contents of their file under~/.atom/recovery
after rebooting their machine when e.g. the system crashes.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.
Okay, that sounds reasonable to me. Would it be worth using the original file basename as part of the filename so that they can be more easily identified?
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.
My main concern there is path length on Windows, which is why I went with a 10-letter random filename for these recovery files. Introducing a variable-length file name could cause weird edge cases on Windows, although it's admittedly more user-friendly. Maybe we can truncate the filename at some arbitrary length, and add a random, fixed-size suffix string? I'll try that shortly.