Recommended Posts

Hi all,

I have noticed that LazyCorn seems to run maybe once or twice and then just stops.

Has anybody else encountered this, I have the following within 2 different modules.

public function init(){
    $this->addHookAfter('ProcessModule::executeEdit', $this, 'configurableButtons');
    wire()->addHook('LazyCron::every15Minutes', $this, 'autoGenerate');
}
public function init(){
    wire('forms')->addHookAfter('ProcessModule::executeEdit', $this, 'configurableButtons');
    wire()->addHook('LazyCron::everyHour', $this, 'getExport');
}

Does having multiple LazyCrons setup cause any issues?

Share this post


Link to post
Share on other sites

LazyCron is driven by user visits. Are you sure the site is being visited regularly? If you need to guarantee a run, you need to setup a cron job to visit a page on your site, or simply use cron itself to drive your tasks. Another possibility is that the cron script is timing out behind the scenes and leaving the LC script jammed.

  • Like 1

Share this post


Link to post
Share on other sites
31 minutes ago, netcarver said:

LazyCron is driven by user visits. Are you sure the site is being visited regularly? If you need to guarantee a run, you need to setup a cron job to visit a page on your site, or simply use cron itself to drive your tasks. Another possibility is that the cron script is timing out behind the scenes and leaving the LC script jammed.

The site has a regular flow of visitors so I don't suspect it is that, the timing out issue could be possible right enough.

What would be the best way to un-jam it if thats the issue? Uninstall/Reinstall LazyCron?

Share this post


Link to post
Share on other sites

Hi @cosmicsafari

Just look in the cache directory for a file called LazyCronLock.cache. If it is there for more than half a minute (or however long you estimate your code should run for) then delete it to unjam LazyCron. If this keeps happening, then there could be something in your hook method that is timing out and leaving the lock file there.

Here's some code to return the location of the file if you want to do it programmatically...

function getLazyCronLockfileName() {
    return wire('config')->paths->cache . "LazyCronLock.cache";
}

 

  • Like 6

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By benbyf
      HELLO!
      Thought of a super interesting module and wondered if anyone had created it or not, and some feedback on the idea.
      New page field defaults - on creating a new child page, you choose a template and page title and click submit -> the resulting page is prepopulated with content dependent on the template you chose.
      Not sure about implmentation yet just thought was an interesting idea.
    • By maxf5
      Hey guys,
      i have some sort of events/campaigns which have a lifespan. To deactivate them i made a checkbox-field called closed and i have to deactivate them manually.
      I would like to put two fields in the template, startdate and enddate, which activate/deactivate that checkbox field automatically.
      Dou you have any idea how to bring that on the run?
    • By maxf5
      Hey guys,
      whenever i install a new modul it works but when i want to go in the settings of the module i get an error:



      ProcessWire 3.0.72 
       
       
    • By benbyf
      Hello,
      Does anyone know whether the is a place detailing the structure your admin theme should take when creating one? e.g. I see UiKit, Reno and Default admin themes all have default.php, init.php, controller.php files, is this a stylisitic choice or a prerequisite for any admin theme module?
      Thanks!