code tidy

This commit is contained in:
Oliver Gorwits
2013-03-26 22:04:00 +00:00
parent 96db66739f
commit 52b28b0ab8

View File

@@ -11,13 +11,13 @@ use namespace::clean;
my $jobactions = { my $jobactions = {
map {$_ => undef} qw/ map {$_ => undef} qw/
discoverall
refresh
macwalk
arpwalk
nbtwalk
backup
/ /
# discoverall
# refresh
# macwalk
# arpwalk
# nbtwalk
# backup
}; };
sub worker_begin { sub worker_begin {
@@ -60,20 +60,21 @@ sub worker_body {
next unless defined $jobactions->{$a}; next unless defined $jobactions->{$a};
my $sched = $jobactions->{$a}; my $sched = $jobactions->{$a};
if ($sched->{when}->next_time($win_start) < $win_end) { # next occurence of job must be in this minute's window
# queue it! next unless $sched->{when}->next_time($win_start) < $win_end;
# due to a table constraint, this will fail if a similar job is
# already queued. # queue it!
try { # due to a table constraint, this will (intentionally) fail if a
debug "scheduler ($wid): queueing $a job"; # similar job is already queued.
schema('netdisco')->resultset('Admin')->create({ try {
action => $a, debug "scheduler ($wid): queueing $a job";
device => ($sched->{device} || undef), schema('netdisco')->resultset('Admin')->create({
subaction => ($sched->{extra} || undef), action => $a,
status => 'queued', device => ($sched->{device} || undef),
}); subaction => ($sched->{extra} || undef),
}; status => 'queued',
} });
};
} }
} }
} }