qbcore-framework / qb-mechanicjob

Mechanic Job For QB-Core
GNU General Public License v3.0
33 stars 174 forks source link

[OPTIMIZATION] Fix driving distance update time #64

Closed ChristianBDev closed 1 year ago

ChristianBDev commented 1 year ago

Describe Pull request Makes the Driving Distance update every 60 seconds/minute

If your PR is to fix an issue mention that issue here

60 This is the fix and is optimized to 0.0 -> 0.01 on update

Questions (please complete the following information):

GodyFromDiscord commented 1 year ago

LGTM

tom-osborne commented 1 year ago

This seems like bad practice to add a wait time in the middle of two update events.

I would recommend that this issue is resolved by caching the distance in Lua and moving the database update to a less frequently called event, or perhaps on a vehicle exit event even.

Either way, this should be considered further.

ChristianBDev commented 1 year ago

This seems like bad practice to add a wait time in the middle of two update events.

I would recommend that this issue is resolved by caching the distance in Lua and moving the database update to a less frequently called event, or perhaps on a vehicle exit event even.

Either way, this should be considered further.

If you have a better way to do this add it here

ChristianBDev commented 1 year ago

@tom-osborne we shouldn't cache the distance, as if you crash and get flown out the vehicle, it will still keep track. When you exit the vehicle, it should stop the driving distance automatically, Wait(3000) should be good enough.

github-actions[bot] commented 1 year ago

This PR has had 60 days of inactivity & will close within 7 days