}
my $body = $frame->body;
- my $args = decode_json($body);
+ my $args = decode_json($body); # TODO Should this be from_json? Check utf8 flag.
# FIXME This means we need to have create the DB entry before
# It could work in a first step, but then we will want to handle job that will be created from the message received
} else {
my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });
while ( my $job = $jobs->next ) {
- my $args = decode_json($job->data);
+ my $args = $job->json->decode($job->data);
process_job( $job, { job_id => $job->id, %$args } );
}
sleep 10;
die "fork failed!" unless defined $pid;
- my $patron = Koha::Patrons->find($job->borrowernumber);
- if ( $patron ) {
- C4::Context->_new_userenv(-1);
- C4::Context->set_userenv(
- $patron->borrowernumber, $patron->userid,
- $patron->cardnumber, $patron->firstname,
- $patron->surname, $patron->branchcode,
- $patron->library->branchname, $patron->flags
- );
- $job->process( $args );
- C4::Context->_unset_userenv(-1);
- } ese {
- $job->process( $args );
- }
+ $job->process( $args );
exit;
}