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