Bug 33898: Alternative approach with receive frame timeout
See bug 33898 comment6. Test plan: Based on comment12: Stage MARC import and manage. Look at the same time to the results of ps aux|grep Z. Verify that the lines with [background_jobs] <defunct> disappear within 10 seconds. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
4e166e07c1
commit
bc42006019
1 changed files with 4 additions and 2 deletions
|
@ -73,6 +73,7 @@ my ( $help, @queues );
|
||||||
my $max_processes = $ENV{MAX_PROCESSES};
|
my $max_processes = $ENV{MAX_PROCESSES};
|
||||||
$max_processes ||= C4::Context->config('background_jobs_worker')->{max_processes} if C4::Context->config('background_jobs_worker');
|
$max_processes ||= C4::Context->config('background_jobs_worker')->{max_processes} if C4::Context->config('background_jobs_worker');
|
||||||
$max_processes ||= 1;
|
$max_processes ||= 1;
|
||||||
|
my $mq_timeout = $ENV{MQ_TIMEOUT} // 10;
|
||||||
|
|
||||||
my $not_found_retries = {};
|
my $not_found_retries = {};
|
||||||
my $max_retries = $ENV{MAX_RETRIES} || 10;
|
my $max_retries = $ENV{MAX_RETRIES} || 10;
|
||||||
|
@ -114,9 +115,10 @@ if ( $conn ) {
|
||||||
}
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
if ( $conn ) {
|
if ( $conn ) {
|
||||||
my $frame = $conn->receive_frame;
|
my $frame = $conn->receive_frame( { timeout => $mq_timeout } );
|
||||||
if ( !defined $frame ) {
|
if ( !defined $frame ) {
|
||||||
# maybe log connection problems
|
# timeout or connection issue?
|
||||||
|
$pm->reap_finished_children;
|
||||||
next; # will reconnect automatically
|
next; # will reconnect automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue