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 ryanC
      Hi, I have created a new install of Processwire 3.0.98, (local machine) and I am unable to install any modules from within Processwire itself. I go to Modules/Site/Add New/ then under "Module Class Name" I enter the name. The module appears, I hit "Download and Install", but I always get an error. For example: 
      "File could not be downloaded (https://github.com/adrianbj/TracyDebugger/archive/master.zip) 2: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version, 2: fsockopen(): Failed to enable crypto, 2: fsockopen(): unable to connect to ssl://github.com:443 (Unknown error) (tried: curl, fopen, socket)"
      I have been able to track down some of the modules and just upload the zip file manually, but this is happening with every module that I had previously installed in another installation with no problems. Any ideas? 
      Thanks!
    • By bystefu
      Hello,i  am new here. A hour ago i bought a vps and i want  to make a website about movies.
      - a home page
      - a movie page with title, description,  trailer ,year and actors
      -categories, tags 
      - a complex search page by name,tags,year and acts
      - posts, latest news (about site)
       
      It's already to much
      I leave wordpress,from my needs it's very complicated. So,minimal speaking, i can do that with this cms,and which is the steps? I don't know yet how this work.Thank you,and sorry for my eng.

    • By neosin
      There are lots of great looking modules that I would like to use but I am hesitant to install them purely due to the lack of visual indication that they are compatible with PW v3+. Most of the ones I want to use say they are compatible with previous versions up to 2.7 so a few questions:
      Does this mean they are not compatible with v3 ? it would seem so since they lack the v3 tag If I try them and something doesn't work and I remove them are all traces removed or can they leave artifacts behind in the DB or filesystem? thanks in advance
    • By maxi032
      I am new to PW and I am starting to like it but it is somehow hard to navigate in backend and to search for compatible modules. May I make a suggestion? When I am here: https://modules.processwire.com/authors/soma/ it would have been nice to be able to browse modules by compatibility version if I need to browse only those compatible with v3.x
    • By benbyf
      Thought I's try SystemNotifications and found it over kill as I would get alot of warnings, changes and errors appearing and persisting which was scaring my client. But now I'm unable to uninstall it without getting errors on the user edit page saying it requires a module that doesnt exsist any more... anyone had this issue or can recommend how to use this module correctly?