Multithreaded server
#8

[quote=jeffery30162;3588815]I do have a lot of saving on my server in the mysql database but it only saves every 30 minutes or when I shut down the server. Also it saves the players data when they disconnect.

I would try to delay the saving between each player, like 2 second for each player, this could probably prevent the server from "hanging"..

Example:
pawn Код:
new CurrentID;

//Every 30 minute
TrySavingAllWithoutLag()
{
    CurrentID = -1;
    TimerName();
}

Save(playerid) return 1;//Replace with your saving function.

forward TimerName();
public TimerName()
{
    if(++CurrentID == GetPlayerPoolSize()+1) return 1;

    if(IsPlayerConnected(CurrentID)) Save(CurrentID);
    SetTimer("TimerName", 2000, false);
    return 1;
}
//Note: It was never tested and not guaranteed to work, it's just an idea.
Also, You don't have to save everything every 30 minutes, try to decrease them and just save the important stuff, and try to get a database at the save host.
Reply


Messages In This Thread
Multithreaded server - by jeffery30162 - 01.10.2015, 19:42
AW: Multithreaded server - by Kaliber - 01.10.2015, 19:44
Re: Multithreaded server - by jeffery30162 - 01.10.2015, 21:26
Re: Multithreaded server - by Pottus - 01.10.2015, 21:31
Re: Multithreaded server - by PrO.GameR - 01.10.2015, 21:57
Re: Multithreaded server - by jeffery30162 - 01.10.2015, 22:04
Re: Multithreaded server - by Pottus - 01.10.2015, 22:38
Re: Multithreaded server - by xVIP3Rx - 02.10.2015, 02:13

Forum Jump:


Users browsing this thread: 2 Guest(s)