Jump to content

Problem firing lazyCron


VeiJari
 Share

Recommended Posts

Hello forum! I'm trying to learn how to time up my functions by using lazycron but I can't get it fired up. 

Here's my code in site/init.php:

function setEventToRepeat(HookEvent $e) {
$wire->log->message("kutsutaan cron");
$events = $wire->pages->find('template=tapahtuma');
die(var_dump($events));
$wire->log->message('Kaikki tapahtumat haettu:' .$events);
}
 
$wire->addHook('LazyCron::every30Seconds', null, 'setEventToRepeat');

I get nothing in the logs and can't echo or dump anything

Thanks for the help!

Link to comment
Share on other sites

Maybe your lazyCron is locked.

Look into your /site/assets/lazycron/ or in /site/assets/ folder. Don't know the exact path and name right now. 

There should be a lazycron file and maybe even a lazycron.locked file. The last one prevents LazyCron from working due to an error that occured before. 

  • Like 2
Link to comment
Share on other sites

Then if $wire works for the hook $wire inside the funtion doesn't work, need to use wire(). And yes the lock file is most likely the problem cause of using $wire inside your function.

  • Like 3
Link to comment
Share on other sites

1 hour ago, Soma said:

Then if $wire works for the hook $wire inside the funtion doesn't work, need to use wire(). And yes the lock file is most likely the problem cause of using $wire inside your function.

Ah, that explains it.

Thank you for clarifying it! Now it works ?

1 hour ago, wbmnfktr said:

Maybe your lazyCron is locked.

Look into your /site/assets/lazycron/ or in /site/assets/ folder. Don't know the exact path and name right now. 

There should be a lazycron file and maybe even a lazycron.locked file. The last one prevents LazyCron from working due to an error that occured before. 

This was also the problem, didn't know there was such a file! Thank you.

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

×
×
  • Create New...