BOTS Runcron is taking too much time

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
vitinho444
Posts: 2825
Joined: Mon Mar 21, 2011 4:54 pm

BOTS Runcron is taking too much time

Post 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?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: BOTS Runcron is taking too much time

Post 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?
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2825
Joined: Mon Mar 21, 2011 4:54 pm

Re: BOTS Runcron is taking too much time

Post 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.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: BOTS Runcron is taking too much time

Post 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.
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2825
Joined: Mon Mar 21, 2011 4:54 pm

Re: BOTS Runcron is taking too much time

Post by vitinho444 »

The crons are not like the normal ones, the script is called inside almost every page :)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: BOTS Runcron is taking too much time

Post 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).
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2825
Joined: Mon Mar 21, 2011 4:54 pm

Re: BOTS Runcron is taking too much time

Post by vitinho444 »

Why they dont show up on me?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: BOTS Runcron is taking too much time

Post 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.
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2825
Joined: Mon Mar 21, 2011 4:54 pm

Re: BOTS Runcron is taking too much time

Post 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..
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: BOTS Runcron is taking too much time

Post by Jackolantern »

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
Post Reply

Return to “Advanced Help and Support”