Jump to content

Lazycron not working


benbyf
 Share

Recommended Posts

I get messages turning up fine in my logs when used in my templates but not working (nothing happens) in my module for some reason. Here's what I have roughly:

class customModule extends WireData implements Module, ConfigurableModule {

	public static function getModuleInfo() {
		return array(
			...
			'autoload' => true,
			'requires' => "LazyCron",
		);
	}
	private $cron_check = "everyMinute";

	public function init() {
		// add hooks to CRON
	    $this->addHook("LazyCron::every30Seconds", $this, 'checkFeedForNewPages');
	}


	public function checkFeedForNewPages(HookEvent $e){
		wire()->log->save('messages', 'working again');
	}
}

 

Link to comment
Share on other sites

Do you have a LazyCron.cache file in /site/assets/cache?

Maybe it's locked or corrupt or something that somehow prevents LazyCron to check and use that file and therefore doesn't work at all.

Oh... and maybe try using that hook in /site/ready.php and go from there.

Edited by wbmnfktr
added ready.php suggestion
Link to comment
Share on other sites

1 hour ago, wbmnfktr said:

Do you have a LazyCron.cache file in /site/assets/cache?

Maybe it's locked or corrupt or something that somehow prevents LazyCron to check and use that file and therefore doesn't work at all.

Oh... and maybe try using that hook in /site/ready.php and go from there.

yep I have both LazyCron.casche and LazuCronLock.cache both there... should i delete them both to reset???

I ideally want it to work as a module as its needs to be duplicated to other sites and not as a singular modele - e.g. you can install several times to repeat for different needs... also I've made it work in teh past which is mostly whats annoying me that it no longer works as ive previously done it.

Link to comment
Share on other sites

23 minutes ago, benbyf said:

should i delete them both to reset?

Yes, please. The LazyCronLock.cache means there was an issue and LazyCron was stopped. You can safely delete both files in your DEV environment. Take a look at them. There are just timestamps in them, so LazyCron can check on those.

Using ready.php was for testing purposes only. LazyCron will work from within a module. I use that a lot for maintenance tasks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...