Quote:
Originally Posted by Rohanlogs
Yes, I think it would be smarter to have 1 plugin handle the queries.
However it could be a rather tiresome coding task if you have many plugins with a lot of functions and variables, to have them all communicate to a single plugin.
Idk if the improvement would be that dramatic, but I noticed a long time ago when using the sqlx library on many plugins to save data on mapchange, even with threaded queries, it caused heavy lag/small crash everytime the map changed, making the loading screen like 4x longer.
I solved this lag by hooking a function X seconds before mapchange to save players stats.
I made some variation on each plugin when to execute the save so they don't all execute at once.
This completely fixed the laggy loading screen when the map changed.
If you do something like this you need to add a check on client_disconnect if the players stats are already saved, to not save them again.
This of course may cause some "lost" stats, for example if you are tracking player kills, and a player kills someone during the last second after the save queries were already called, that kill would not be saved.
But in my case it was well worth it to fix the lag/crash of the loading screen.
|
I fixed this by completely just not using mysql at all, but rather communicate with my mongodb through a crud api, with amxxeasyhttp, i can do all queries whenever and it won't lag the server or hang the thread (sql would do that even when using threaded tuples).
__________________