Skip to content

Commit 4b4f90e

Browse files
committed
graph start and finish of crons by default
1 parent 3a13482 commit 4b4f90e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Daemonise/Plugin/KyotoTycoon.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ after 'configure' => sub {
173173
$self->cache_default_expire(24 * 60 * 60);
174174
die 'locking failed' unless $self->lock;
175175
$self->cache_default_expire($expire);
176+
177+
$self->graph('cron.' . $self->name, 'started', 1)
178+
if $self->can('graph');
176179
}
177180

178181
return;
@@ -382,7 +385,7 @@ sub DESTROY {
382385
return unless ref $self;
383386
return unless $self->{is_cron};
384387

385-
# the Cache::KyotoTycoon object was already destroyed to we need to create
388+
# the Cache::KyotoTycoon object was already destroyed, so we need to create
386389
# a new one with the existing config
387390
$self->tycoon(
388391
Cache::KyotoTycoon->new(
@@ -394,6 +397,9 @@ sub DESTROY {
394397

395398
$self->unlock;
396399

400+
$self->graph('cron.' . $self->name, 'stopped', 1)
401+
if $self->can('graph');
402+
397403
return;
398404
}
399405

lib/Daemonise/Plugin/Redis.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ after 'configure' => sub {
168168
$self->cache_default_expire(24 * 60 * 60);
169169
die 'locking failed' unless $self->lock;
170170
$self->cache_default_expire($expire);
171+
172+
$self->graph('cron.' . $self->name, 'started', 1)
173+
if $self->can('graph');
171174
}
172175

173176
return;
@@ -356,6 +359,9 @@ sub DESTROY {
356359

357360
$self->unlock;
358361

362+
$self->graph('cron.' . $self->name, 'stopped', 1)
363+
if $self->can('graph');
364+
359365
return;
360366
}
361367

0 commit comments

Comments
 (0)