-
Notifications
You must be signed in to change notification settings - Fork 201
Feature/Fix: Implement Atomic Write Pattern for Instance File Integrity #503
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
Open
FaiThiX
wants to merge
65
commits into
alexemanuelol:instance_invalid
Choose a base branch
from
FaiThiX:fix-crash-destroy-instance-file
base: instance_invalid
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/Fix: Implement Atomic Write Pattern for Instance File Integrity #503
FaiThiX
wants to merge
65
commits into
alexemanuelol:instance_invalid
from
FaiThiX:fix-crash-destroy-instance-file
Conversation
This file contains hidden or 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
alexemanuelol#324) * add credentials guide for web version * add rustplusplus credentials app extension links * add rustplus token description
* New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Czech) * New translations en.json (German) * New translations en.json (Italian) * New translations en.json (Korean) * New translations en.json (Polish) * New translations en.json (Russian) * New translations en.json (Swedish) * New translations en.json (Turkish)
* Temporary solution to fcm notifications problem * fix smart switch/storage monitor/smart alarm pairing * fcm -> authtoken, hoster -> steamId * Update RustPlus.js removed extra lines * Update discordEmbeds.js removed extra lines * Update guildMemberRemove.js removed extra lines * Update discordMessages.js fixed merge conflict * Update AuthTokenListener.js whitespace correction and changed data to notification --------- Co-authored-by: Alexander Emanuelsson <alexander.emanuelsson94@gmail.com> Co-authored-by: FaiThiX <admin@faithix.gg>
…ow start a 5min polling session
…se notifications are basically useless when notification listening only lasts 5 min
This reverts commit 881faa2.
* New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Czech) * New translations en.json (German) * New translations en.json (Italian) * New translations en.json (Korean) * New translations en.json (Polish) * New translations en.json (Russian) * New translations en.json (Swedish) * New translations en.json (Turkish)
* Update FcmListener.js * Update FcmListenerLite.js
* add travelingvendor map stuff * add traveling vendor commands for ingame and discord * fixes and img change for testing * changed the traveling vendor command from trvendor to vendor * updated image links for the discord embed * update docs for traveling vendor * changed spawned event message * add vendor image. thanks to davinator for the image * added halted and moving again setting * added missing translation * fixxed misspell * add information embed * vender -> vendor * new icon for traveling vendor (thanks to threedm on discord)
* New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Czech) * New translations en.json (German) * New translations en.json (Italian) * New translations en.json (Korean) * New translations en.json (Polish) * New translations en.json (Portuguese) * New translations en.json (Russian) * New translations en.json (Swedish) * New translations en.json (Turkish)
* New translations en.json (French) * New translations en.json (Russian)
* Add issue template * fix: adapt bug_report for nodejs project
* Updated Items November 2025 * Added CCTV for Cargo Ship and Ferry Terminal * Updated items.json with build-in script
* Updated Items November 2025 * Added CCTV for Cargo Ship and Ferry Terminal * Updated items.json with build-in script * add choices to the context menu - bugfix
* Updated Items November 2025 * Added CCTV for Cargo Ship and Ferry Terminal * Updated items.json with build-in script * add choices to the context menu - bugfix * fix vendingMachines sellorders
…rruption issues during system crashes.)
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 pull request addresses a critical issue where instance configuration files ([guildId].json) could become corrupted or truncated if the application or the host system crashed (e.g., power outage) during a file write operation.
🛠️ Solution Implemented: Atomic Write Pattern
The writeInstanceFile function has been refactored to use the Atomic Write Pattern:
Data is written to a temporary file (.tmp).
The file contents are explicitly synchronized to the disk using fsyncSync.
The temporary file is then atomically renamed to replace the original file (Fs.renameSync()).
This ensures that the targetPath file will always be either the last complete version or the new, complete version, thus preventing partial writes and corruption.
🧹 Cleanup
The readInstanceFile function was also updated to check for and remove any lingering .tmp files left behind by a previous, failed write attempt (cleanup of "stale temporary files").
🛡️ Benefit
This change significantly improves the data integrity and fault tolerance of the application.
Also updated the instance_invalid branch to the latest changes