Bugzilla – Attachment 61649 Details for
Bug 15032
[Plack] Scripts that fork (like stage-marc-import.pl) don't work as expected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15032: Try to fix background jobs - batch_record_modification.pl
Bug-15032-Try-to-fix-background-jobs---batchrecord.patch (text/plain), 3.18 KB, created by
Jonathan Druart
on 2017-03-27 20:39:11 UTC
(
hide
)
Description:
Bug 15032: Try to fix background jobs - batch_record_modification.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-27 20:39:11 UTC
Size:
3.18 KB
patch
obsolete
>From 72b070c3f4c48ff7853eb7b2116d8473eb375b44 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 27 Mar 2017 17:25:33 -0300 >Subject: [PATCH] Bug 15032: Try to fix background jobs - > batch_record_modification.pl > >I do not really understand how behave this patch, sometimes it works, >sometimes not. >It would be good to get other people testing and reading it to try and >understand what's happening. It may be a first step to fix our >background jobs. > >The thing is that we cannot close STDOUT, Plack (CGI::Emulate::PSGI) is >expecting it opened (search for 'seek'). > >If we close STDOUT and keep 'text/html' in the headers, it works almost >correctly: but we got the JSON content + the headers printed by the >child. >With the redirect we a getting the right page when the job is finished. >But sometimes we see the plain text content (with the JSON headers) + a >302 > >Any thoughts? >--- > debian/templates/apache-shared-intranet-plack.conf | 1 - > tools/batch_record_modification.pl | 17 +++++++++-------- > 2 files changed, 9 insertions(+), 9 deletions(-) > >diff --git a/debian/templates/apache-shared-intranet-plack.conf b/debian/templates/apache-shared-intranet-plack.conf >index 5ae8e07..e12f325 100644 >--- a/debian/templates/apache-shared-intranet-plack.conf >+++ b/debian/templates/apache-shared-intranet-plack.conf >@@ -13,7 +13,6 @@ > #Â don't break under plack/starman > ProxyPass "/cgi-bin/koha/offline_circ/process_koc.pl" "!" > ProxyPass "/cgi-bin/koha/tools/background-job-progress.pl" "!" >- ProxyPass "/cgi-bin/koha/tools/batch_record_modification.pl" "!" > ProxyPass "/cgi-bin/koha/tools/batchMod.pl" "!" > ProxyPass "/cgi-bin/koha/tools/manage-marc-import.pl" "!" > ProxyPass "/cgi-bin/koha/tools/stage-marc-import.pl" "!" >diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl >index 6ea0317..7c4a714 100755 >--- a/tools/batch_record_modification.pl >+++ b/tools/batch_record_modification.pl >@@ -159,15 +159,11 @@ if ( $op eq 'form' ) { > $job = C4::BackgroundJob->new( $sessionID, "FIXME", '/cgi-bin/koha/tools/batch_record_modification.pl', $job_size ); > my $job_id = $job->id; > if (my $pid = fork) { >- $dbh->{InactiveDestroy} = 1; >- > my $reply = CGI->new(""); >- print $reply->header(-type => 'text/html'); >+ print $reply->header(-type => 'application/json'); > print '{"jobID":"' . $job_id . '"}'; > exit 0; >- } elsif (defined $pid) { >- close STDOUT; >- } else { >+ } elsif (not defined $pid) { > warn "fork failed while attempting to run tools/batch_record_modification.pl as a background job"; > exit 0; > } >@@ -244,8 +240,13 @@ if ( $op eq 'form' ) { > } > > if ($runinbackground) { >- $job->finish if defined $job; >- } else { >+ if ( $job ) { >+ $job->finish; >+ print $input->redirect('/cgi-bin/koha/tools/background.pl?just_a_param=1'); >+ } >+ } >+ else { >+ # FIXME Do not think this is reach > $template->param( > view => 'report', > report => $report, >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15032
:
43625
|
44011
| 61649