Page 1 of 1

BOTS Runcron is taking too much time

Posted: Fri Nov 02, 2012 7:09 pm
by vitinho444
Hello guys, i want to release my browser based game but i faced a problem.. The runcron that handles all bots for resources per hour and stuff takes more than the 30 seconds of script running time limit..

For now i have 1000 bots.. so.. every hour when runcron goes it needs to go over the 1000 bots..

What can i do?

Re: BOTS Runcron is taking too much time

Posted: Sat Nov 03, 2012 3:10 am
by Jackolantern
The script is taking longer than 30 seconds to execute? So to be clear, it is iterating over each of the 1000 bots and performing actions? It should still be able to do that easily in well under 30 seconds. You must have a bottle-neck somewhere. Can you post the cron script?

Re: BOTS Runcron is taking too much time

Posted: Sat Nov 03, 2012 11:19 am
by vitinho444
I think those errors happened because i had errors in there.. so 1000 errors is a lot to compute i think...

It is working for now. But another problem: When i login there are some pages that instead of using the $_SESSION it just uses other player id and present as if i was a bot... :O Can't figure why .. My code is all messed up i think, jacko can you visit the Village Wars source code in my signature and set it up? You will see the problem.

Re: BOTS Runcron is taking too much time

Posted: Sat Nov 03, 2012 5:59 pm
by Jackolantern
I am not on a Linux machine, and am unclear on the settings for Windows Scheduler to run the crons. I am not even sure the code would be portable as-is.

Re: BOTS Runcron is taking too much time

Posted: Sat Nov 03, 2012 10:27 pm
by vitinho444
The crons are not like the normal ones, the script is called inside almost every page :)

Re: BOTS Runcron is taking too much time

Posted: Sun Nov 04, 2012 12:09 am
by Jackolantern
I got the database set up from the SQL script, but when I tried to log in, it just threw out around 15 errors, all relating to cron scripts (at least they had cron in their title; it may have been the same script I suppose, but they were all different errors).

Re: BOTS Runcron is taking too much time

Posted: Sun Nov 04, 2012 12:35 am
by vitinho444
Why they dont show up on me?

Re: BOTS Runcron is taking too much time

Posted: Sun Nov 04, 2012 3:09 am
by Jackolantern
Ahh, the SQL backup script was missing a table called "spy" that is called by the cron scripts, so this line doesn't return anything:

Code: Select all

$result = mysql_query("SELECT * FROM spy", $db);
You probably added this table after making the SQL dump. I am assuming that causes the cascade of errors.

Re: BOTS Runcron is taking too much time

Posted: Sun Nov 04, 2012 11:41 am
by vitinho444
After fixing that, can you login and logout? I can't, because i think my session is not being activated.. therefore in the username and points info i got the information from a NPC..

Re: BOTS Runcron is taking too much time

Posted: Sun Nov 04, 2012 4:43 pm
by Jackolantern
I am not sure what needs to be in the spy database table. What is supposed to be in it?