make psql worker primary, add hook debug log

This commit is contained in:
Oliver Gorwits
2017-09-06 18:27:34 +01:00
parent 36c70220a2
commit a59c23de79
2 changed files with 5 additions and 4 deletions

View File

@@ -2,10 +2,9 @@ package App::Netdisco::Worker::Plugin::Psql;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
register_worker(sub {
register_worker({ primary => true }, sub {
my ($job, $workerconf) = @_;
my ($device, $port, $extra) = map {$job->$_} qw/device port extra/;

View File

@@ -82,9 +82,11 @@ sub run {
sub run_workers {
my $self = shift;
my $hook = shift or return $self->jobstat->error('missing hook param');
my $primary = ($hook =~ m/_primary$/);
my $store = Dancer::Factory::Hook->instance();
# debug "entering hook $hook";
my $primary = ($hook =~ m/_primary$/);
return unless scalar @{ $store->get_hooks_for($hook) };
debug "running workers for hook: $hook";
foreach my $worker (@{ $store->get_hooks_for($hook) }) {
try {