Skip to content

Conversation

@FaiThiX
Copy link
Contributor

@FaiThiX FaiThiX commented Nov 23, 2025

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

alexemanuelol and others added 30 commits March 15, 2024 22:32
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>
…se notifications are basically useless when notification listening only lasts 5 min
alexemanuelol and others added 30 commits September 10, 2024 21:57
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants