BOTS Runcron is taking too much time
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
BOTS Runcron is taking too much time
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?
For now i have 1000 bots.. so.. every hour when runcron goes it needs to go over the 1000 bots..
What can i do?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: BOTS Runcron is taking too much time
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?
The indelible lord of tl;dr
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: BOTS Runcron is taking too much time
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.
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: BOTS Runcron is taking too much time
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.
The indelible lord of tl;dr
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: BOTS Runcron is taking too much time
The crons are not like the normal ones, the script is called inside almost every page
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: BOTS Runcron is taking too much time
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).
The indelible lord of tl;dr
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: BOTS Runcron is taking too much time
Why they dont show up on me?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: BOTS Runcron is taking too much time
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:
You probably added this table after making the SQL dump. I am assuming that causes the cascade of errors.
Code: Select all
$result = mysql_query("SELECT * FROM spy", $db);
The indelible lord of tl;dr
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: BOTS Runcron is taking too much time
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..
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: BOTS Runcron is taking too much time
I am not sure what needs to be in the spy database table. What is supposed to be in it?
The indelible lord of tl;dr