Foren / Cotonti / Core Labs / Ideas / CRON Engine

diablo
#7515 10. Februar 2009, 05:32
i dont know much about race condition but here is my idea
we can use a second check for unique cron job name
for instance we will run the job "Inactive User Cleaner" its unique name lets say "iuc"
it will check the cache first if its expired it will attempt to add it to its "to-do list" since the job names gonna be unique it will give error when it attempts to add "iuc" to the list. so the at the 1st proc it will be added to list but at 2nd proc it will stop since it will fail adding it to the "list"

so

check cache()
if expired
{
check list()
if not in list
{
add to list*
}
else
{
die
}

}
execute cron job list


* since it wont be able to add list the function wont work further
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."

Dieser Beitrag wurde von diablo (am 10. Februar 2009, 05:40, vor 16 Jahre) bearbeitet