View | Details | Raw Unified | Return to bug 32558
Collapse All | Expand All

(-)a/debian/templates/koha-conf-site.xml.in (+5 lines)
Lines 457-462 __END_SRU_PUBLICSERVER__ Link Here
457
   <vhost>__MESSAGE_BROKER_VHOST__</vhost>
457
   <vhost>__MESSAGE_BROKER_VHOST__</vhost>
458
 </message_broker>
458
 </message_broker>
459
459
460
 <background_jobs_worker>
461
     <!-- Max simultaneous processes per worker -->
462
     <max_processes>1</max_processes>
463
 </background_jobs_worker>
464
460
 <do_not_remove_cookie>__KEEP_COOKIE__</do_not_remove_cookie>
465
 <do_not_remove_cookie>__KEEP_COOKIE__</do_not_remove_cookie>
461
 <do_not_remove_cookie>catalogue_editor_\d+</do_not_remove_cookie>
466
 <do_not_remove_cookie>catalogue_editor_\d+</do_not_remove_cookie>
462
 <!-- Uncomment lines like hereunder to not clear cookies at logout:
467
 <!-- Uncomment lines like hereunder to not clear cookies at logout:
(-)a/etc/koha-conf.xml (+5 lines)
Lines 274-279 Link Here
274
   <vhost></vhost>
274
   <vhost></vhost>
275
 </message_broker>
275
 </message_broker>
276
276
277
 <background_jobs_worker>
278
     <!-- Max simultaneous processes per worker -->
279
     <max_processes>1</max_processes>
280
 </background_jobs_worker>
281
277
 <do_not_remove_cookie>catalogue_editor_\d+</do_not_remove_cookie>
282
 <do_not_remove_cookie>catalogue_editor_\d+</do_not_remove_cookie>
278
 <!-- Uncomment lines like hereunder to not clear cookies at logout:
283
 <!-- Uncomment lines like hereunder to not clear cookies at logout:
279
      The cookie name is case sensitive.
284
      The cookie name is case sensitive.
(-)a/misc/background_jobs_worker.pl (-1 / +16 lines)
Lines 52-67 use JSON qw( decode_json ); Link Here
52
use Try::Tiny;
52
use Try::Tiny;
53
use Pod::Usage;
53
use Pod::Usage;
54
use Getopt::Long;
54
use Getopt::Long;
55
use Parallel::ForkManager;
55
56
56
use Koha::Logger;
57
use Koha::Logger;
57
use Koha::BackgroundJobs;
58
use Koha::BackgroundJobs;
59
use C4::Context;
58
60
59
my ( $help, @queues );
61
my ( $help, @queues );
62
63
my $max_processes = $ENV{MAX_PROCESSES};
64
$max_processes ||= C4::Context->config('background_jobs_worker')->{max_processes} if C4::Context->config('background_jobs_worker');
65
$max_processes ||= 1;
66
60
GetOptions(
67
GetOptions(
68
    'm|max-processes=i' => \$max_processes,
61
    'h|help' => \$help,
69
    'h|help' => \$help,
62
    'queue=s' => \@queues,
70
    'queue=s' => \@queues,
63
) || pod2usage(1);
71
) || pod2usage(1);
64
72
73
warn "MAX PROCEDS: $max_processes";
74
65
pod2usage(0) if $help;
75
pod2usage(0) if $help;
66
76
67
unless (@queues) {
77
unless (@queues) {
Lines 75-80 try { Link Here
75
    warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_;
85
    warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_;
76
};
86
};
77
87
88
my $pm = Parallel::ForkManager->new($max_processes);
89
78
if ( $conn ) {
90
if ( $conn ) {
79
    # FIXME cf note in Koha::BackgroundJob about $namespace
91
    # FIXME cf note in Koha::BackgroundJob about $namespace
80
    my $namespace = C4::Context->config('memcached_namespace');
92
    my $namespace = C4::Context->config('memcached_namespace');
Lines 115-121 while (1) { Link Here
115
            next;
127
            next;
116
        }
128
        }
117
129
130
        $pm->start and next;
118
        process_job( $job, $args );
131
        process_job( $job, $args );
132
        $pm->finish;
119
133
120
    } else {
134
    } else {
121
        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });
135
        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });
Lines 130-136 while (1) { Link Here
130
144
131
            next unless $args;
145
            next unless $args;
132
146
147
            $pm->start and next;
133
            process_job( $job, { job_id => $job->id, %$args } );
148
            process_job( $job, { job_id => $job->id, %$args } );
149
            $pm->finish;
134
150
135
        }
151
        }
136
        sleep 10;
152
        sleep 10;
137
- 

Return to bug 32558