Open somatonic opened 9 years ago
My call is in a autoload module init()
$this->addHook("LazyCron::every60Minutes", $this, "cartMaintenance");
This is the cache
1421341501 1421341501 1421341501 1421341362 1421341362 1421341501 1421341362 1421341362 1421340921 1421339520 1421339693 1421337225 1421337885 1421334208 1421325271 1421256427 1421211359 1421082956 1421230301 1420556459 1419346733
Is there a copy of the module I could test with? (or a trimmed down copy that only contains the parts necessary to duplicate is fine too)
I'm calling $this->addHook('LazyCron::every30Seconds', $this, 'hookEvery30Seconds');
from an autoload module in the init (dev 2.5.15). The method hookEvery30Seconds is never called. I've never used LazyCron before so maybe there's something wrong about the code below.
Stupid me ! Had forgotten to install LazyCron. Sorry for the inconvenience.
class CronAndLog extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Cron and log',
'version' => 100,
'summary' => 'Lazycron then log.',
'singular' => true,
'autoload' => true
);
}
public function init() {
$this->addHook('LazyCron::every30Seconds', $this, 'hookEvery30Seconds');
}
public function hookEvery30Seconds(HookEvent $event) {
$seconds = $event->arguments[0];
$this->log->save('lazycron', 'lazycron: ' . $seconds);
}
}
I have the same problem as somatonic describes. Works a few times, then it stops. Had the same problem (I think) when embedding the code inside a template.
Example code:
public function init() {
$this->addHook('LazyCron::every30Seconds', $this, 'myHook');
}
public function myHook(HookEvent $e) {
$matches = wire('pages')->find('counter>0');
if ($matches->count > 0) {
foreach ($matches as $m) {
$m->counter = 0;
$m->of(false);
$m->save('counter');
$m->of(true);
}
}
}
What about adding every5Seconds for quicker debugging?
I have a LazyCron hook in a autoload module set to 60min, it get's executed a few times then it's never executed again. What gives?
My log looks like this. 2015-01-09 08:56:00 philipp.urlich http://domain.com/ lazycron called 2015-01-09 09:58:01 philipp.urlich http://domain.com/wb/abo/kasse/ lazycron called 2015-01-09 10:00:22 philipp.urlich http://domain.com/processwire/module/ lazycron called 2015-01-09 09:02:33 philipp.urlich http://domain.com/ lazycron called 2015-01-09 10:04:40 philipp.urlich http://domain.com/wb/abo/registration/ lazycron called
How can this be?