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

(-)a/misc/workers/es_indexer_daemon.pl (-8 / +6 lines)
Lines 75-82 $batch_size //= 10; Link Here
75
75
76
die "Not using Elasticsearch" unless C4::Context->preference('SearchEngine') eq 'Elasticsearch';
76
die "Not using Elasticsearch" unless C4::Context->preference('SearchEngine') eq 'Elasticsearch';
77
77
78
my $logger = Koha::Logger->get;
78
my $logger = Koha::Logger->get({ interface =>  'worker' });
79
$logger->debug_to_screen;
80
79
81
my $conn;
80
my $conn;
82
try {
81
try {
Lines 113-119 while (1) { Link Here
113
            my $body = $frame->body;
112
            my $body = $frame->body;
114
            decode_json($body); # TODO Should this be from_json? Check utf8 flag.
113
            decode_json($body); # TODO Should this be from_json? Check utf8 flag.
115
        } catch {
114
        } catch {
116
            $logger->debug(sprintf "Frame not processed - %s", $_);
115
            $logger->warn(sprintf "Frame not processed - %s", $_);
117
            return;
116
            return;
118
        } finally {
117
        } finally {
119
            $conn->ack( { frame => $frame } );
118
            $conn->ack( { frame => $frame } );
Lines 126-132 while (1) { Link Here
126
        my $job = Koha::BackgroundJobs->find($args->{job_id});
125
        my $job = Koha::BackgroundJobs->find($args->{job_id});
127
126
128
        unless ( $job ) {
127
        unless ( $job ) {
129
            $logger->debug(sprintf "No job found for id=%s", $args->{job_id});
128
            $logger->warn(sprintf "No job found for id=%s", $args->{job_id});
130
            next;
129
            next;
131
        }
130
        }
132
131
Lines 158-164 sub commit { Link Here
158
        my $args = try {
157
        my $args = try {
159
	    $job->json->decode($job->data);
158
	    $job->json->decode($job->data);
160
        } catch {
159
        } catch {
161
            $logger->debug(sprintf "Cannot decode data for job id=%s", $job->id);
160
            $logger->warn(sprintf "Cannot decode data for job id=%s", $job->id);
162
	    $job->status('failed')->store;
161
	    $job->status('failed')->store;
163
	    return;
162
	    return;
164
        };
163
        };
Lines 174-187 sub commit { Link Here
174
        try {
173
        try {
175
	    $auth_indexer->update_index(\@auth_records);
174
	    $auth_indexer->update_index(\@auth_records);
176
        } catch {
175
        } catch {
177
	    $logger->debug(sprintf "Update of elastic index failed with: %s", $_);
176
	    $logger->warn(sprintf "Update of elastic index failed with: %s", $_);
178
        };
177
        };
179
    }
178
    }
180
    if( @bib_records ){
179
    if( @bib_records ){
181
        try {
180
        try {
182
	    $biblio_indexer->update_index(\@bib_records);
181
	    $biblio_indexer->update_index(\@bib_records);
183
        } catch {
182
        } catch {
184
	    $logger->debug(sprintf "Update of elastic index failed with: %s", $_);
183
	    $logger->warn(sprintf "Update of elastic index failed with: %s", $_);
185
        };
184
        };
186
    }
185
    }
187
186
188
- 

Return to bug 32594