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

(-)a/Koha/BackgroundJob/UpdateElasticIndex.pm (-19 / +5 lines)
Lines 17-25 package Koha::BackgroundJob::UpdateElasticIndex; Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use JSON qw( encode_json decode_json );
21
22
use Koha::DateUtils qw( dt_from_string );
23
use Koha::SearchEngine;
20
use Koha::SearchEngine;
24
use Koha::SearchEngine::Indexer;
21
use Koha::SearchEngine::Indexer;
25
22
Lines 54-67 Process the modification. Link Here
54
sub process {
51
sub process {
55
    my ( $self, $args ) = @_;
52
    my ( $self, $args ) = @_;
56
53
57
    # FIXME If the job has already been started, but started again (worker has been restart for instance)
54
    $self->start;
58
    # Then we will start from scratch and so double process the same records
59
60
    my $job_progress = 0;
61
    $self->started_on(dt_from_string)
62
        ->progress($job_progress)
63
        ->status('started')
64
        ->store;
65
55
66
    my @record_ids = @{ $args->{record_ids} };
56
    my @record_ids = @{ $args->{record_ids} };
67
    my $record_server = $args->{record_server};
57
    my $record_server = $args->{record_server};
Lines 93-106 sub process { Link Here
93
        $report->{total_success} = scalar @record_ids;
83
        $report->{total_success} = scalar @record_ids;
94
    }
84
    }
95
85
96
    my $job_data = decode_json $self->data;
86
    my $data = $self->decoded_data;
97
    $job_data->{messages} = \@messages;
87
    $data->{messages} = \@messages;
98
    $job_data->{report} = $report;
88
    $data->{report} = $report;
99
89
100
    $self->ended_on(dt_from_string)
90
    $self->finish( $data );
101
        ->data(encode_json $job_data);
102
    $self->status('finished') if $self->status ne 'cancelled';
103
    $self->store;
104
}
91
}
105
92
106
=head3 enqueue
93
=head3 enqueue
107
- 

Return to bug 30360