+ return $e;
+ }
+
+ /**
+ * Push a task into the job queue system and catch/log any exceptions
+ *
+ * @param EnqueueableDataUpdate $update
+ * @param LBFactory $lbFactory
+ * @param LoggerInterface $logger
+ * @param StatsdDataFactoryInterface $stats
+ * @param string $httpMethod
+ */
+ private static function jobify(
+ EnqueueableDataUpdate $update,
+ LBFactory $lbFactory,
+ LoggerInterface $logger,
+ StatsdDataFactoryInterface $stats,
+ $httpMethod
+ ) {
+ $stats->increment( "deferred_updates.$httpMethod." . get_class( $update ) );
+
+ $e = null;
+ try {
+ $spec = $update->getAsJobSpecification();
+ JobQueueGroup::singleton( $spec['domain'] ?? $spec['wiki'] )->push( $spec['job'] );
+ } catch ( Exception $e ) {
+ } catch ( Throwable $e ) {
+ }
+
+ if ( $e ) {
+ $logger->error(
+ "Job insertion of deferred update {type} failed: {message}",
+ [
+ 'type' => get_class( $update ),
+ 'message' => $e->getMessage(),
+ 'trace' => $e->getTraceAsString()
+ ]
+ );
+ $lbFactory->rollbackMasterChanges( __METHOD__ );
+ }