Lines 121-139
while (1) {
Link Here
|
121 |
} catch { |
121 |
} catch { |
122 |
Koha::Logger->get({ interface => 'worker' })->warn(sprintf "Frame not processed - %s", $_); |
122 |
Koha::Logger->get({ interface => 'worker' })->warn(sprintf "Frame not processed - %s", $_); |
123 |
return; |
123 |
return; |
124 |
} finally { |
|
|
125 |
$conn->ack( { frame => $frame } ); |
126 |
}; |
124 |
}; |
127 |
|
125 |
|
128 |
next unless $args; |
126 |
my $job; |
129 |
|
127 |
|
130 |
# FIXME This means we need to have create the DB entry before |
128 |
if ($args) { |
131 |
# It could work in a first step, but then we will want to handle job that will be created from the message received |
129 |
$job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; |
132 |
my $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; |
130 |
unless ($job) { |
|
|
131 |
Koha::Logger->get( { interface => 'worker' } ) |
132 |
->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); |
133 |
|
133 |
|
134 |
unless( $job ) { |
134 |
# nack to force requeue |
135 |
Koha::Logger->get( { interface => 'worker' } ) |
135 |
$conn->nack( { frame => $frame, requeue => 1 } ); |
136 |
->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); |
136 |
next; |
|
|
137 |
} |
138 |
$conn->ack( { frame => $frame } ); |
139 |
} else { |
137 |
next; |
140 |
next; |
138 |
} |
141 |
} |
139 |
|
142 |
|
140 |
- |
|
|