r93971 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93970‎ | r93971 | r93972 >
Date:14:15, 5 August 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Use APC caching to send incremental TCP requests, rather than using rand();
Modified paths:
  • /branches/wmf/1.17wmf1/includes/SquidUpdate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/SquidUpdate.php
@@ -148,10 +148,25 @@
149149 }
150150 $url = SquidUpdate::expand( $url );
151151
 152+ // Try and incremement value in APC cache
 153+ $id = apc_inc( 'squidhtcppurge' );
 154+ if ( $id === false ) {
 155+ // If false, means it didn't work
 156+ // Chances are that means it isn't in the cache
 157+ // Start saving a cached value
 158+ $add = apc_add( 'squidhtcppurge', 1 );
 159+ if ( $add === true ) {
 160+ wfDebugLog( 'htcp', 'Unable to set value to APC cache' );
 161+ $id = 0;
 162+ } else {
 163+ $id = $add;
 164+ }
 165+ }
 166+
152167 // Construct a minimal HTCP request diagram
153168 // as per RFC 2756
154169 // Opcode 'CLR', no response desired, no auth
155 - $htcpTransID = rand();
 170+ $htcpTransID = $id;
156171
157172 $htcpSpecifier = pack( 'na4na*na8n',
158173 4, 'HEAD', strlen( $url ), $url,

Follow-up revisions

RevisionCommit summaryAuthorDate
r93972Fix boolean fail from r93971reedy14:16, 5 August 2011
r975051.18wmf1 Merge r83867, r93686, r93807, r93971, r93972 (some manually do to lo...reedy15:31, 19 September 2011

Comments

#Comment by Reedy (talk | contribs)   23:22, 5 August 2011

s/TCP/UDP/

Status & tagging log