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

(-)a/Koha/BackgroundJobs.pm (-21 lines)
Lines 72-98 sub filter_by_current { Link Here
72
    );
72
    );
73
}
73
}
74
74
75
=head3 finish
76
77
    my $jobs->finish;
78
79
Finishes multiple jobs, assumes you have handled success or failure.
80
81
=cut
82
83
sub finish {
84
    my ($self) = @_;
85
  
86
    while( my $job = $self->next ){
87
        $job->update({
88
	    progress => $job->size(),
89
	    status => 'finished',
90
	    ended_on =>\'NOW()'
91
            },{ no_triggers => 1});
92
    }
93
94
}
95
96
=head2 Internal methods
75
=head2 Internal methods
97
76
98
=head3 _type
77
=head3 _type
(-)a/misc/workers/es_indexer_daemon.pl (-2 / +15 lines)
Lines 151-156 sub commit { Link Here
151
151
152
    my @bib_records;
152
    my @bib_records;
153
    my @auth_records;
153
    my @auth_records;
154
155
    my $jobs = Koha::BackgroundJobs->search( { id => [ map { $_->id } @jobs ] });
156
    # Start
157
    $jobs->update({
158
        progress => 0,
159
        status => 'started',
160
        started_on => \'NOW()',
161
    });
162
154
    for my $job (@jobs) {
163
    for my $job (@jobs) {
155
        my $args = try {
164
        my $args = try {
156
            $job->json->decode( $job->data );
165
            $job->json->decode( $job->data );
Lines 182-186 sub commit { Link Here
182
        };
191
        };
183
    }
192
    }
184
193
185
    Koha::BackgroundJobs->search( { id => [ map { $_->id } @jobs ] })->finish();
194
    # Finish
195
    $jobs->update({
196
        progress => 1,
197
        status => 'finished',
198
        ended_on => \'NOW()',
199
    });
186
}
200
}
187
- 

Return to bug 32594