Commit graph

31 commits

Author SHA1 Message Date
Derick Alangi
f8337198ce Job::factory should throw an InvalidArgumentException, not MWException
Change-Id: I9a85562b205db604d2746ec5db0e72dacdb93c6d
2019-02-11 23:35:47 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
James D. Forrester
f8ac266287 Job: Remove insert() and batchInsert(), deprecated since 1.21
Bug: T179624
Change-Id: I0d78a926c8c513fd652a424e8a51ded20e524a4a
2018-05-21 20:10:09 +01:00
Aaron Schulz
c6b668c2ec Do not start explicit transaction rounds for RecentChangesUpdateJob
The replaces the hacky use of onTransactionIdle(), which no longer runs
immediately in explicit transaction rounds since d4c31cf841.

Also clarified TransactionRoundDefiningUpdate comment about rounds.

Change-Id: Ie17eacdcaea4e47019cc94e1c7beed9d7fec5cf2
2018-04-17 12:39:05 +00:00
James D. Forrester
970557f89d Job::insert: Hard deprecate (soft-deprecated in 1.21!)
Change-Id: I5b653a3dacd6dc73a80b6bbcc282fdd5dad6e49a
2017-11-02 15:07:39 -07:00
Lucas Werkmeister
a57252a1f5 Allow callback functions for creating jobs
$wgJobClasses can now specify a factory function for creating a job,
instead of a class to be instantiated directly. This makes it possible
to inject services in a job constructor, and register a factory function
that calls the constructor with default services.

This follows Ieb85493a7765 and Ia2107dc5af78, which introduced factory
functions for API modules and special pages.

Change-Id: I0461e59da2a8fa6681e3b1fcdfc38bfed7f3ac32
2017-05-09 19:26:13 +02:00
Gergő Tisza
d304f5e394 Pass Job success status to teardown callbacks
Change-Id: Icf2e03efcfd9232fe4ead776096b61cef1c06141
2016-10-05 02:55:45 +00:00
Erik Bernhardson
afc3b5a120 Track which web request created a job
We currently push a request id into structured logging (monolog/
logstash) to allow seeing all logs that were triggered by the same
request. This extends that to pass the id through jobs so jobs triggered
by a web request also share the same id and can be tracked together.
This web request id will follow jobs both directly created by a request,
and jobs created by those jobs.

This should give us some more visibility when debugging into what
started a particular job, and if a large number of jobs blowing up the
job queue are somehow related.

Change-Id: Iedbd031e6e9bb18fd6f7b923c8c305102255ab4b
2016-04-13 10:41:13 -07:00
Aaron Schulz
4a28737c32 Make Job::toString() handle array parameters better
Previously it would result in array(x) in fairly simple cases.

Change-Id: I6bfe67faa45835babb2c7e259b5cd158e0f0a649
2016-03-16 03:45:35 -07:00
jenkins-bot
d716155c8b Merge "Reset scoped session for upload jobs after deferred updates" 2016-03-01 11:30:55 +00:00
Aaron Schulz
1ac63f1767 Reset scoped session for upload jobs after deferred updates
Bug: T126450
Change-Id: I8a6588209647252a4509078aaa7bf0cb1d9d299a
2016-02-24 10:54:31 -08:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
d705ae970a Fixes related to WikiPage::triggerOpportunisticLinksUpdate()
* Focus on updating links that would *not* already be updated
  by jobs, not those that already *will* be updated.
* Place the jobs into a dedicated queue so they don't wait
  behind jobs that actually have to parse every time. This
  helps avoid queue buildup.
* Make Job::factory() set the command field to match the value
  it had when enqueued. This makes it easier to have the same
  job class used for multiple queues.
* Given the above, remove the RefreshLinksJob 'prioritize' flag.
  This worked by overriding getType() so that the job went to a
  different queue. This required both the special type *and* the
  flag to be set if using JobSpecification or either ack() would
  route to the wrong queue and fail or the job would go in the
  regular queue. This was too messy and error prone. Cirrus jobs
  using the same pattern also had ack() failures for example.

Change-Id: I5941cb62cdafde203fdee7e106894322ba87b48a
2015-10-24 00:10:12 +00:00
Aaron Schulz
df2dc2ef9b Improved job pickup time stats for delayed jobs
* The delay time should not count

Bug: T102743
Change-Id: I9e8b1f33b65681fd9f4f667233bce280bf6f227d
2015-07-01 21:00:09 +00:00
jenkins-bot
f33c9e9e71 Merge "Automatically deduplicate root jobs on insertion" 2015-06-05 20:15:23 +00:00
Aaron Schulz
e2826974c6 Automatically deduplicate root jobs on insertion
* This makes lazyPush() simple to use in more cases

Change-Id: I22e74485eaf3120e5669c5ee55dc7ab7310d7300
2015-06-03 20:58:20 +00:00
Kunal Mehta
f138447de1 jobqueue: Record stats on how long it takes before a job is run
Bug: T101054
Change-Id: I5dc13d79a5ec2e8cb6679e3ff2535b5cb031ca30
2015-06-03 12:54:27 -07:00
Aaron Schulz
9632223e4c Fixed Job constructor IDE notices about variable types
Change-Id: I4b4e4e38e8d416c3445c52ced311f5fbfcde868a
2015-05-30 08:09:30 +00:00
Aaron Schulz
83111f29e2 Use ksort() in getDeduplicationInfo for sanity
Change-Id: Id23cc987b3f1e23b35b0eedbfc5c9978774a0ebd
2015-03-19 10:45:39 -07:00
Aaron Schulz
9150bef93d Added some job queue comments
Change-Id: If42b982ac339cc6aaf56ef2ed6c78867b83d2e56
2015-01-17 15:39:31 -08:00
Aaron Schulz
8912aef33f Expose job metadata in showJobs and the jobs log
* This means that redis job UUIDs now show up in these places

Change-Id: Icea168de7e1590bfe275646bc2ccbb7151f032ae
2014-10-22 18:40:18 +00:00
jenkins-bot
201928033d Merge "Added another size limit check to Job::toString" 2014-10-21 00:11:54 +00:00
Aaron Schulz
d695a8a5e4 Removed deprecated Job methods
Change-Id: Ib7a06ab19b31472c99cdccd418011beb6f075ca4
2014-10-20 15:00:37 -07:00
Aaron Schulz
4c7c74afc2 Added another size limit check to Job::toString
Change-Id: I5a6e94eb98769b33d0ea44273d0eee8ee669dd17
2014-10-08 17:15:05 -07:00
addshore
f960c2434b Add tests for Job::toString
Change-Id: I00f41808af42a198a1e45a93201dd7bb3e4d9c2c
2014-09-23 21:57:31 +01:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
Aaron Schulz
a61ff504fe For job param arrays of scalars, show the key/values as JSON in the log
Change-Id: Ia9056dd1d4669102178046961ddaf6e8560e5903
2014-05-16 15:23:28 -07:00
Thiemo Mättig
e292bc972d Finish removing boolean return values from JobQueue code
This is a follow-up for patch
Ia706ac0122a7dd7f418e2dc2d3bd36e9a0252c25.

Change-Id: I19fe58a939706d3f7594d937e0bcad6d97c52a50
2014-04-28 22:21:58 +02:00
umherirrender
dcf6955e5c Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ifbb1da2a6278b0bde2a6f6ce2e7bd383ee3fb28a
2014-04-20 23:33:05 +02:00
Aaron Schulz
9ffd4f085d Renamed /job to /jobqueue
Change-Id: I4c8a2b42140630838867c77a70d45ba14b5d95e2
2014-03-14 13:42:04 -07:00
Renamed from includes/job/Job.php (Browse further)