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 7

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 jrtderonde
      Hey,
      I'm working around a module that adds pages in my ProcessWire installation. The pages are added based on a JSON array that will be imported through a page save. Everything works fine except for when the pages are added. I get the following error
      Integrity constraint violation: 1062 Duplicate entry '3e215ecd6774fd99c2b0eb5cadf36a07-1269' for key 'name_parent_id' I'm using the following code/loop to generate the pages.
      // Loop through the files foreach ($p->importFile as $file) { // Set the file location $name = $file->data["basename"]; $path = $p->importFile->path; $location = $path . $name; // Get the file $json = file_get_contents($location); $json = json_decode($json); // Loop through the rows of the import foreach ($json->ttEntityDelAddrLink as $client) { // Create new page $new = new Page(); // Create unique hash $unique = md5(date("Y-m-d H:i:s") . "-" . $client->CustomerCode); // Set some variables for the new page $new->setOutputFormatting(false); $new->template = "_client"; $new->parent = $p; // Create hash $new->title = $client->DelAddressName; $new->name = $unique; // Page specific fields $new->company = $client->DelAddressName; $new->companyId = $client->CustomerCode; $new->city = $client->DelAddressCity; $new->address = $client->DelAddressStreet; $new->postcode = $client->DelAddressZipCode; $new->country = $countries[$client->DelAddressCountryCode]; // Save the page $new->save(); } // Exit for debugging exit; }
      Does anybody know what's wrong?
    • 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