#1084 move slow skiplist build to the first job on running backend

This commit is contained in:
Oliver Gorwits
2023-09-05 22:55:33 +01:00
parent 8b47e7e2f8
commit 3a820c06e4
10 changed files with 180 additions and 77 deletions

View File

@@ -7,6 +7,17 @@ use aliased 'App::Netdisco::Worker::Status';
use App::Netdisco::JobQueue 'jq_insert';
use Dancer::Plugin::DBIC 'schema';
register_worker({ phase => 'check' }, sub {
return Status->defer("macwalk skipped: have not yet primed skiplist")
unless schema(vars->{'tenant'})->resultset('DeviceSkip')
->search({
backend => setting('workers')->{'BACKEND'},
device => '255.255.255.255',
})->count();
return Status->done('Macwalk is able to run');
});
register_worker({ phase => 'main' }, sub {
my ($job, $workerconf) = @_;