SA-MP Forums Archive
[Question] Mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Question] Mysql (/showthread.php?tid=287782)



[Question] Mysql - tony_fitto - 04.10.2011

Hey guys,

I just found an issue with my mysql server, and some how when your connecting to the server you seems to lost the connection after a while when it's saying "joining server."

and suddenly the server restarts, it's like you have to high ping and the server automaticly restarts.

Any idйas why?


Re: [Question] Mysql - Kingunit - 04.10.2011

We can't read your mind. Drop your code here.


Re: [Question] Mysql - tony_fitto - 04.10.2011

Well there aint a code for this, or maby.

I think it's something wrong with the connection to my mysql server cause of the restart.

pawn Код:
mysql_connect(HOST_ADDR, HOST_USER, HOST_PASS, HOST_DATA);
Thats the only think I can come up to that might be an issue...


Re: [Question] Mysql - Tigerkiller - 04.10.2011

which mysql plugin did you use ?


Re: [Question] Mysql - NRG2 - 04.10.2011

I had a problem simular to this aswell. My sever was to overloaded running with a high ammount of RAM and taking alot of CPU.. I think it was around 40% on a i7 Processor Computer which was really bad. So I sorted out a few files. Deleted some filterscripts that went in use and walla' it went down to 2%. But I advise cleaning your folder. Removing any unwanted items out of it and keeping it that way. I also advise not to use so much mapped objects with a streamer. Streamers take up aload of CPU and that's why I also had to create a new map with only cars and icons on it to work fully functionaly.


Re: [Question] Mysql - tony_fitto - 05.10.2011

Quote:
Originally Posted by NRG2
Посмотреть сообщение
I had a problem simular to this aswell. My sever was to overloaded running with a high ammount of RAM and taking alot of CPU.. I think it was around 40% on a i7 Processor Computer which was really bad. So I sorted out a few files. Deleted some filterscripts that went in use and walla' it went down to 2%. But I advise cleaning your folder. Removing any unwanted items out of it and keeping it that way. I also advise not to use so much mapped objects with a streamer. Streamers take up aload of CPU and that's why I also had to create a new map with only cars and icons on it to work fully functionaly.
Hmm Nice, It sounds great.
Thanks for the advice I'm going to check it right away.


Re: [Question] Mysql - [L3th4l] - 05.10.2011

If you are using G-Stylezzz's mysql plugin, yes, you will lose connection after a while. What you can do is, make a timer checking if mysql_ping == -1 and if so, use mysql_reconnect. ( Not sure if it happens on other plugins since I've only used G-Stylezzz's )


Re: [Question] Mysql - tony_fitto - 07.10.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
If you are using G-Stylezzz's mysql plugin, yes, you will lose connection after a while. What you can do is, make a timer checking if mysql_ping == -1 and if so, use mysql_reconnect. ( Not sure if it happens on other plugins since I've only used G-Stylezzz's )
At the moment the first tips I got didn't work, going to test this out.
Thanks alot, just a quick questions under which public section should I pust this mysql_reconnect and mysql_ping?

Regards Tony,


Re: [Question] Mysql - Wesley221 - 07.10.2011

Like L3th4l said, create a timer.
Im not sure about the MySQL functions, but with this youre able to continue:
pawn Код:
new MySQLTimer; // global variable for the timer
forward MySQLChecker(); // forwarding the timer

MySQLTimer = SetTimer("MySQLChecker", 3000 /*can be more, can be less etc*/, true); // add this to OnGameModeInit

public MySQLChecker()
{
    // MySQL functions to check the ping etc
    return 1;
}

KillTimer(MySQLTimer); // add this on OnGameModeExit



Re: [Question] Mysql - [L3th4l] - 07.10.2011

You don't actually need a 3 second timer, it disconnects after a while running. So I say you use a ~15 min timer.