Commit graph

13 commits

Author SHA1 Message Date
Umherirrender
0d706ed09e Return directly from within try/finally block
It is good code style to return a variable from the same scope as it is
definied and not from a level deeper.
For try/finally blocks this does not change the behaviour because the
finally block is executed if the scope is leaved, normally or by return
or by thrown exception.

This helps static code analyzer like phan to understand the code better.

Change-Id: Ib947e58adb3676b1d69507a15ea44d93c5a9973d
2020-07-20 15:54:32 +00:00
Tim Starling
7f710a514a Fast stale ParserCache responses
If PoolCounter acquisition would block and a stale ParserCache entry is
available, deliver it immediately rather than waiting for the lock. This
should avoid PoolCounter contention on heavily edited pages.

* Add a fastStale pool option to toggle the feature. False by default
  but I'll set the default to true in a followup commit.
* Add a $timeout parameter to PoolCounter::acquireForMe() and
  acquireForAnyone(). This requires a simultaneous update to the
  PoolCounter extension.
* In the Redis implementation, use the requested timeout for blPop()
  but use the configured timeout for data structure cleanup and item
  expiry.
* Add a boolean $fast parameter to fallback() which tells the subclass
  whether it is being called in the fast or slow mode. No extensions
  in CodeSearch extend PoolCounterWork directly so this should not
  cause a fatal.
* Pass through the $fast parameter in PoolCounterWorkViaCallback
* In PoolWorkArticleView, use the $fast flag to decide whether to check
  the ChronologyProtector touched timestamp.
* Add $wgCdnMaxageStale by analogy with $wgCdnMaxageLagged, which
  controls the CC:s-maxage when sending a stale ParserOutput.
* Fix the documented type of the timeout. It really should be a float,
  but locks.c will treat non-integers as zero.

A simultaneous update to the PoolCounter extension is required.

Bug: T250248
Change-Id: I1f410cd5d83588e584b6d27d2e106465f0fad23e
2020-06-05 16:24:22 +10:00
Peter Ovchyn
212f155abb poolcounter: Call poolCounter->release on exception and add tests for PoolCounterWork
Add type hitting to correctly cover object construction.

Bug: T249531
Change-Id: I20c61a08813cf564e07dc3a8272727a1e1043348
2020-04-10 12:51:25 +03:00
Aaron Schulz
0848e9049c rdbms: fix some phpstorm warnings database classes
Change-Id: Ib3b8aaadda8101ed82158b1260f10f6d7be16783
2019-07-13 21:49:51 +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
Aaron Schulz
39ed32922e Include type in hashKeyIntoSlots()
Otherwise, all pool types that use slots will collide
due to the slotted keys not using a type prefix.

Bug: T134144
Change-Id: Ib367fedf2cfb7fecc290206e69e0d105276e96e6
2016-05-09 16:54:51 -07: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
umherirrender
f6e19c0afe Fixed some docs
- Added since to @deprecated
- Use lowercase array on @param
- Added missing type on @param
- Swapped type and variable on @param
- Fixed spelling of @return

Change-Id: Idbbc6b4c8aadb6d98c636f53024ac513346c912b
2014-08-13 20:01:46 +02:00
addshore
880e496a30 Split PoolCounterWorkViaCallback into own file
Change-Id: I9c920cd03351a2b2b155247d58fbb2280d4d3775
2014-08-09 00:44:59 +01:00
Aaron Schulz
78a654eddc Made pool counter better handled nested calls
* This is useful for the "GetLocalFileCopy" pool for example.

Change-Id: Ie9f092fb595d12ebc6548571cecbd2f4251297db
2014-06-05 15:21:32 -07:00
Aaron Schulz
87cdc96510 Include pool type in pool counter log entries
Change-Id: I1b0213b5af755208843cb2cd02d3446c480f6882
2014-04-21 10:37:14 -07:00
umherirrender
b45420410f 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.
Also added some missing @param.

Change-Id: Iced714bca004756b461b66067a49a925a7e3b877
2014-04-19 22:22:20 +02:00
Aaron Schulz
fbf97f572c Re-organized PoolCounter files
* No actual changes to the classes

Change-Id: I4e35a2b097e4bc72315688d0390d3f5c4c1ca4ed
2014-04-02 11:08:22 -07:00
Renamed from includes/PoolCounter.php (Browse further)