Better handling of jobs execution in post-connection shutdown
authorSeb35 <seb35@seb35.fr>
Mon, 29 May 2017 22:58:56 +0000 (00:58 +0200)
committerSeb35 <seb35@seb35.fr>
Thu, 1 Jun 2017 11:16:08 +0000 (13:16 +0200)
commitd80fca05e18d9654b8458ed6966c5d3c4991d88e
treea7836090009964ab81d8143ea9e01eab8dafb645
parent6c7d4481d71f7d4d1e6172ad2da68e61883fc0e5
Better handling of jobs execution in post-connection shutdown

In the postprocessing, some jobs can be executed but given the deferred
updates were already "closed", any new DeferredUpdate were directly called
(as explained by Krinkle on T165714), and the transactions opened by
classical jobs are badly mixed with transactions (directly) executed by
DeferredUpdates jobs, issuing a DBError, avoiding the job, which stays
in a 'claimed' status even if failed.

Quite similarly, some DeferredUpdates callables use JobQueueGroup::lazyPush
so it is needed to really push the generated jobs.

This change removes the run-immediately-deferred-updates behaviour even
in the post-connection shutdown, and given there is a call to
DeferredUpdates::doUpdates in JobRunner::execute it is not necessary to
add another one and hence execution of Web jobs is more similar to execution
of CLI jobs. In the same spirit to reconcile Web jobs and CLI jobs, the
call to JobQueueGroup::pushLazyJobs is done in JobRunner::execute.

Bug: T165714
Bug: T100085
Change-Id: I721e7167eca5b0b6227234fe516005243ab22388
includes/MediaWiki.php
includes/deferred/DeferredUpdates.php
includes/jobqueue/JobRunner.php