Skip to content

fix(es_extended/server/functions): improve Core.SavePlayers & Core.SavePlayer#1591

Closed
Kenshiin13 wants to merge 8 commits intoesx-framework:devfrom
Kenshiin13:refactor-player-save
Closed

fix(es_extended/server/functions): improve Core.SavePlayers & Core.SavePlayer#1591
Kenshiin13 wants to merge 8 commits intoesx-framework:devfrom
Kenshiin13:refactor-player-save

Conversation

@Kenshiin13
Copy link
Copy Markdown
Contributor

@Kenshiin13 Kenshiin13 commented Jan 9, 2025

Description

Improves the performance of the Core.SavePlayers & Core.SavePlayer functions.


Motivation

Larger servers experience regular server thread hitches when ESX saves all of their players. This PR aims to improve that.


Implementation Details

  • Only save lastPlayTime player metadata on player leave.
  • Set player metadata directly when saving players. This avoids unnecessary type checks, as well as client events.
  • Get player coords directly when saving position. Avoids redundant native calls to get a players ped.
  • Added optional new Core.SavePlayers function while keeping the old one enabled by default through a new config option. The new one avoids any native calls entirely by sacraficing the players position, health and armour data. This can be saved on player leave, though it may result in data loss when the client or server crashes.

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@Kenshiin13 Kenshiin13 self-assigned this Jan 9, 2025
@Kenshiin13
Copy link
Copy Markdown
Contributor Author

Stale PR

@Kenshiin13 Kenshiin13 closed this Jun 11, 2025
@github-project-automation github-project-automation Bot moved this from 🆕 To be Discussed to Recycle Bin in ESX Roadmap Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Recycle Bin

Development

Successfully merging this pull request may close these issues.

1 participant