Lag on connect caused by SQL - need help.
Hey guys I'm having a problem, Whenever a new map loads on the server I get SQL lag while the server checks all the clients if they have rated or not. Is there anyway i could add a delay so that it does not check all the clients simotaniously.. Thanks for any help. I posted the code below that i am using.
PHP Code:
|
Re: Lag on connect caused by SQL - need help.
im a newbie to coding n such, but couldnt you loop through and set a task like
PHP Code:
edit: i have been informed by a trustworthy source that doing it that way is very bad. darn |
Re: Lag on connect caused by SQL - need help.
Thanks for trying to help :), does anyone know of a way thats not a very bad way to do that?
|
Re: Lag on connect caused by SQL - need help.
There is no point in using sqlx if it is used like that...
Remove all SQL_Connect, SQL_PrepareQuery, SQL_Execute and use SQL_ThreadQuery instead. edit: With SQL_ThreadQuery you can check all players simultaneously and there will be no lag. I don't understand what is this plugin supposed to do. It would make sense if there was only 1 map on server, but once map changes and players vote again, then vote for previous map is overwritten. I checked orginal plugin and in my opinion it suck... |
Re: Lag on connect caused by SQL - need help.
it lets you rate a maps on the server, and stores the rating in a db. then you can like put the rating of you mapcycle on your website.
I wouldnt know how to use SQL_ThreadQuery. |
Re: Lag on connect caused by SQL - need help.
not tested:
PHP Code:
|
Re: Lag on connect caused by SQL - need help.
It seems to be working without any lag now. But there is one problem with it, It only allows you to vote once. On the nextmap if you voted for a different map it wont let you vote again.
|
Re: Lag on connect caused by SQL - need help.
I used same sql requests and I detect if you have already voted in the same way. If the old version worked then I'm not sure why this is not working.
You can try to set 2 primary keys (replace line): PHP Code:
You can also create separate table for each map and store only steamid and rating and use 1 primary key. |
Re: Lag on connect caused by SQL - need help.
i changed this, and i deleted the table in the sql but now votes dont happen at all.
PHP Code:
i also changed this so i didnt have to wait forever to test it dunno of that could be the prob. PHP Code:
|
Re: Lag on connect caused by SQL - need help.
I tried it and previous version was almost fine. After mapchange only users who didn't leave server were not able to vote because I forgot is_user_connecting().
this is tested and works fine: PHP Code:
EDIT: if voting does not appear and you don't know why then change this and it will appear 15 secs after mapchange: PHP Code:
|
| All times are GMT -4. The time now is 15:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.