Lines 91-96
try {
Link Here
|
91 |
}; |
91 |
}; |
92 |
|
92 |
|
93 |
if ( $conn ) { |
93 |
if ( $conn ) { |
|
|
94 |
process_outstanding(); |
94 |
# FIXME cf note in Koha::BackgroundJob about $namespace |
95 |
# FIXME cf note in Koha::BackgroundJob about $namespace |
95 |
my $namespace = C4::Context->config('memcached_namespace'); |
96 |
my $namespace = C4::Context->config('memcached_namespace'); |
96 |
$conn->subscribe( |
97 |
$conn->subscribe( |
Lines 132-138
while (1) {
Link Here
|
132 |
} |
133 |
} |
133 |
|
134 |
|
134 |
my $job = Koha::BackgroundJobs->find( $args->{job_id} ); |
135 |
my $job = Koha::BackgroundJobs->find( $args->{job_id} ); |
135 |
|
|
|
136 |
if ( $job && $job->status ne 'new' ) { |
136 |
if ( $job && $job->status ne 'new' ) { |
137 |
Koha::Logger->get( { interface => 'worker' } ) |
137 |
Koha::Logger->get( { interface => 'worker' } ) |
138 |
->warn( sprintf "Job %s has wrong status %s", $args->{job_id}, $job->status ); |
138 |
->warn( sprintf "Job %s has wrong status %s", $args->{job_id}, $job->status ); |
Lines 238-240
sub commit {
Link Here
|
238 |
ended_on => \'NOW()', |
238 |
ended_on => \'NOW()', |
239 |
}); |
239 |
}); |
240 |
} |
240 |
} |
241 |
- |
241 |
|
|
|
242 |
sub process_outstanding { |
243 |
my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => 'elastic_index' }); |
244 |
while ( my $job = $jobs->next ) { |
245 |
commit($job); |
246 |
} |
247 |
return 1; |
248 |
} |