Jump to content
MakeWebGames

No Crons


AlabamaHit

Recommended Posts

Re: No Crons

You need to get real good at using time stamps.

if (jailtime > time()) then you're in jail

that negates the need to do a minute cron updating jail time

follow that mold and you'll likely be able to eliminate most of the crons

 

It's my opinion that some things are best left to crons. If you want something updated once per day, for all users, and it's something that if you performed a check to see if that update was necessary on every page load, it'd consume far more resources than just doing a daily cron.

 

On Tycoon Rats, I use a cron for updating user bars, and a daily cron. That's it. there is no minute cron, or five minute cron. Just a 10 minute and a daily.

 

I prefer to update user bars with crons because I want players that log off to be able to come back to a full bar, instead of requiring activity on their part. If you want their bars fully updated, then there's some math involved, and it has to be performed regularly, say something like:

 

if last update > time() - 60 * 10

THEN do an update, but there's more

how many updates did we miss?

missed updates = ((time() - 60 * 10) - last update) / 10

now multiply the amount you update by the "missed updates" amount

all of this should be self explanatory, if it isn't, then you need to practice with time stamps or you'll muck it up.

Link to comment
Share on other sites

  • 1 month later...

Re: No Crons

To be technical there isn't a lot of difference between that php schedualler and a cron.

I think Alabama is wanting to eliminate the need for schedualling ANYTHING. I could be wrong, but that was my impression.

Certain, that php schedualler is NOT going to be as efficient as using crons, so why would one migrate?

Looking at their documentation, php schedualler is designed to be a solution for folks that don't have access to cron jobs.

And for that purpose, it seems like a fantastic solution to that particular situation. But using it to replace cron jobs, is not a good idea IMHO.

Link to comment
Share on other sites

Guest Anonymous

Re: No Crons

Agreed - any type of fake cron system will ~can~ suffer from some sort of performance hit as it plays catchup.

IMO, Floydian presents the skeleton of a possible solution, using timestamps to track activity, it gets a little tricky at times, but I've successfully integrated into one project.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...