Skip to content
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

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

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

Kenshiin13
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 To be Discussed
Development

Successfully merging this pull request may close these issues.

1 participant