Skip to content

Prevent concurrent server edits and optimize status updates - #135

Merged
Flash303 merged 2 commits into
mainfrom
dev
Oct 25, 2026
Merged

Flash303 merged 2 commits into
mainfrom
dev

Conversation

@Flash303

Copy link
Copy Markdown
Owner

This pull request refactors and extends the server update logic across the repository, API, and worker crates. It splits the previous monolithic update_server and update_servers methods into more granular, purpose-specific operations, introduces a new ServerStatusUpdate struct to streamline status updates, and updates all call sites to use the new methods. This improves code clarity, maintainability, and safety when updating server records.

Repository API refactor and new update methods:

  • Introduced the ServerStatusUpdate struct and changed bulk server status updates to use update_servers_status, which only updates relevant fields and respects forced favicon logic. [1] [2] [3]
  • Added methods to the Repository trait and its Postgres implementation for renaming servers (rename_server), setting hidden status (set_server_hidden), updating favicons (set_server_favicon), and updating server addresses (update_server_address). [1] [2]

API endpoint updates:

  • Refactored admin and user routes to use the new granular repository methods instead of fetching and resaving entire server structs, reducing the risk of unintentional data overwrites. [1] [2] [3] [4] [5] [6]

Worker and ping logic improvements:

  • Updated the worker ping logic to use a new refresh_endpoint helper and to update only the necessary fields via the new status update mechanism, improving efficiency and correctness. [1] [2] [3] [4] [5]

These changes collectively make server updates safer and more explicit, reduce the risk of accidental data loss, and improve the maintainability of the codebase.

@Flash303
Flash303 merged commit cb0d094 into main Oct 25, 2026
4 checks passed
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.

1 participant