forked from diceguyd30/queso_to_go_template
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add new save file handling #22
Merged
ToransuShoujo
merged 22 commits into
ToransuShoujo:master
from
liquidnya:12-reduce-risk-of-currupting-data
Jun 16, 2022
Merged
Add new save file handling #22
ToransuShoujo
merged 22 commits into
ToransuShoujo:master
from
liquidnya:12-reduce-risk-of-currupting-data
Jun 16, 2022
Conversation
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
Delete version 1 files after converting to version 2 Ignore errors when writing files, but log these errors Add custom codes to persistence.js
Adding a level will now add an initial wait time of 1. |
This was referenced Jun 16, 2022
Closed
Remove fs import from queue.js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This will fix issue #12.
This is a draft for introducing a new save file and better handling of saving such file.
The current changes as of now include using the library write-file-atomic to write one single save file for queue state and wait time. The old files are loaded and converted to the new file on startup if needed. The new file is also in the newly introduced directory
data
.The library node-graceful-fs is also used for automatically retrying renaming of files, since that can fail sporadically under windows when the directory is locked, e.g. by virus scanner.
Documentation for the old and new file formats is available as comments in
persistence.js
.The following things need to be done still before this can be merged:
writeFileAtomicAsync
for thecustomCodes.json
fileFigure out if mixingwriteFileAtomic
andwriteFileAtomicAsync
is possible or just rewrite everything to use the async variant except for when the queue is loaded initially→ keep
writeFileAtomicSync
for all uses for now(Optional) Rewrite the queue code that accesses wait time to use the object stored in the save file instead of using 2 lists(Optional) Add the submission date of levels (Clear old entries of the queue #11)(Optional) Add user ids to the wait list (!rename command and store user id #7)Feedback to these changes are highly appreciated and there are open questions:
customCodes.json
file be moved into thedata
directory?→ It is now stored in the
./data
directory.→ This has been merged into this PR.