code tidy
This commit is contained in:
@@ -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,10 +60,12 @@ 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
|
||||||
|
next unless $sched->{when}->next_time($win_start) < $win_end;
|
||||||
|
|
||||||
# queue it!
|
# queue it!
|
||||||
# due to a table constraint, this will fail if a similar job is
|
# due to a table constraint, this will (intentionally) fail if a
|
||||||
# already queued.
|
# similar job is already queued.
|
||||||
try {
|
try {
|
||||||
debug "scheduler ($wid): queueing $a job";
|
debug "scheduler ($wid): queueing $a job";
|
||||||
schema('netdisco')->resultset('Admin')->create({
|
schema('netdisco')->resultset('Admin')->create({
|
||||||
@@ -76,6 +78,5 @@ sub worker_body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user