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

(-)a/Koha/BackgroundJob/UpdateElasticIndex.pm (-20 / +5 lines)
Lines 17-26 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
24
use base 'Koha::BackgroundJob';
20
use base 'Koha::BackgroundJob';
25
21
26
=head1 NAME
22
=head1 NAME
Lines 52-65 Process the modification. Link Here
52
sub process {
48
sub process {
53
    my ( $self, $args ) = @_;
49
    my ( $self, $args ) = @_;
54
50
55
    # FIXME If the job has already been started, but started again (worker has been restart for instance)
51
    $self->start;
56
    # Then we will start from scratch and so double process the same records
57
58
    my $job_progress = 0;
59
    $self->started_on(dt_from_string)
60
        ->progress($job_progress)
61
        ->status('started')
62
        ->store;
63
52
64
    my @record_ids = @{ $args->{record_ids} };
53
    my @record_ids = @{ $args->{record_ids} };
65
    my $record_server = $args->{record_server};
54
    my $record_server = $args->{record_server};
Lines 90-103 sub process { Link Here
90
        $report->{total_success} = scalar @record_ids;
79
        $report->{total_success} = scalar @record_ids;
91
    }
80
    }
92
81
93
    my $job_data = decode_json $self->data;
82
    my $data = $self->decoded_data;
94
    $job_data->{messages} = \@messages;
83
    $data->{messages} = \@messages;
95
    $job_data->{report} = $report;
84
    $data->{report} = $report;
96
85
97
    $self->ended_on(dt_from_string)
86
    $self->finish( $data );
98
        ->data(encode_json $job_data);
99
    $self->status('finished') if $self->status ne 'cancelled';
100
    $self->store;
101
}
87
}
102
88
103
=head3 enqueue
89
=head3 enqueue
104
- 

Return to bug 30360