Bugzilla – Attachment 55257 Details for
Bug 17240
Allow processes that rely on background jobs run in Plack mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17240 - Allow processes that rely on background jobs run in Plack mode - followup
Bug-17240---Allow-processes-that-rely-on-backgroun.patch (text/plain), 2.84 KB, created by
Fridolin Somers
on 2016-09-06 12:48:28 UTC
(
hide
)
Description:
Bug 17240 - Allow processes that rely on background jobs run in Plack mode - followup
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2016-09-06 12:48:28 UTC
Size:
2.84 KB
patch
obsolete
>From 0568f22fc779b2fc0f470dfd52819236602f0037 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 6 Sep 2016 13:55:05 +0200 >Subject: [PATCH] Bug 17240 - Allow processes that rely on background jobs run > in Plack mode - followup > >Followup >If not running in background mode, some calls are made on $job var. >--- > tools/stage-marc-import.pl | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > >diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl >index a5f60bd..473355e 100755 >--- a/tools/stage-marc-import.pl >+++ b/tools/stage-marc-import.pl >@@ -98,6 +98,8 @@ if ($completedJobID) { > # BatchStageMarcRecords can handle that > > my $job = undef; >+ my $progress_interval = 0; >+ my $progress_callback = undef; > my $dbh; > if ($runinbackground) { > my $job_size = scalar(@$marcrecords); >@@ -134,6 +136,11 @@ if ($completedJobID) { > # New handle, as we're a child. > $dbh = C4::Context->dbh({new => 1}); > $dbh->{AutoCommit} = 0; >+ >+ if ($runinbackground) { >+ $progress_interval = 50; >+ $progress_callback = staging_progress_callback( $job, $dbh ); >+ } > # FIXME branch code > my ( $batch_id, $num_valid, $num_items, @import_errors ) = > BatchStageMarcRecords( >@@ -142,21 +149,24 @@ if ($completedJobID) { > $to_marc_plugin, $marc_modification_template, > $comments, '', > $parse_items, 0, >- 50, staging_progress_callback( $job, $dbh ) >+ $progress_interval, $progress_callback > ); > > my $num_with_matches = 0; > my $checked_matches = 0; > my $matcher_failed = 0; > my $matcher_code = ""; >+ if ($runinbackground) { >+ $progress_interval = 50; >+ $progress_callback = matching_progress_callback( $job, $dbh ); >+ } > if ($matcher_id ne "") { > my $matcher = C4::Matcher->fetch($matcher_id); > if (defined $matcher) { > $checked_matches = 1; > $matcher_code = $matcher->code(); > $num_with_matches = >- BatchFindDuplicates( $batch_id, $matcher, 10, 50, >- matching_progress_callback( $job, $dbh ) ); >+ BatchFindDuplicates( $batch_id, $matcher, 10, $progress_interval, $progress_callback ); > SetImportBatchMatcher($batch_id, $matcher_id); > SetImportBatchOverlayAction($batch_id, $overlay_action); > SetImportBatchNoMatchAction($batch_id, $nomatch_action); >@@ -221,6 +231,7 @@ exit 0; > > sub staging_progress_callback { > my $job = shift; >+ return unless $job; > my $dbh = shift; > return sub { > my $progress = shift; >@@ -230,6 +241,7 @@ sub staging_progress_callback { > > sub matching_progress_callback { > my $job = shift; >+ return unless $job; > my $dbh = shift; > my $start_progress = $job->progress(); > return sub { >-- >2.7.4
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 17240
:
55110
|
55111
|
55129
|
55130
|
55137
|
55138
|
55257
|
58461
|
63291
|
63459
|
63862
|
76477
|
76478
|
76479
|
76480
|
76481
|
76482