r109007 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109006‎ | r109007 | r109008 >
Date:22:21, 15 January 2012
Author:aaron
Status:ok (Comments)
Tags:filebackend 
Comment:
* Killed an RTT in SwiftFileBackend::doStreamFile(). We already check existence in FileBackend::streamFile()
* A few minor code cleanups and comment tweaks.
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/SwiftFileBackend.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/SwiftFileBackend.php
@@ -25,9 +25,9 @@
2626
2727 /** @var CF_Connection */
2828 protected $conn; // Swift connection handle
 29+ protected $connTTL = 120; // integer seconds
2930 protected $connStarted = 0; // integer UNIX timestamp
3031 protected $connContainers = array(); // container object cache
31 - protected $connTTL = 120; // integer seconds
3232
3333 protected $swiftProxyUser; // string
3434
@@ -367,7 +367,7 @@
368368 return $status;
369369 }
370370
371 - // (c) Delete the container if empty
 371+ // (b) Delete the container if empty
372372 if ( $contObj->object_count == 0 ) {
373373 try {
374374 $this->deleteContainer( $fullCont );
@@ -503,16 +503,12 @@
504504
505505 try {
506506 $cont = $this->getContainer( $srcCont );
507 - $obj = $cont->get_object( $srcRel );
508507 } catch ( NoSuchContainerException $e ) {
509508 $status->fatal( 'backend-fail-stream', $params['src'] );
510509 return $status;
511 - } catch ( NoSuchObjectException $e ) {
512 - $status->fatal( 'backend-fail-stream', $params['src'] );
 510+ } catch ( InvalidResponseException $e ) {
 511+ $status->fatal( 'backend-fail-connect', $this->name );
513512 return $status;
514 - } catch ( IOException $e ) {
515 - $status->fatal( 'backend-fail-stream', $params['src'] );
516 - return $status;
517513 } catch ( Exception $e ) { // some other exception?
518514 $status->fatal( 'backend-fail-stream', $params['src'] );
519515 $this->logException( $e, __METHOD__, $params );
@@ -521,9 +517,10 @@
522518
523519 try {
524520 $output = fopen( 'php://output', 'w' );
 521+ $obj = new CF_Object( $cont, $srcRel, False, False ); // skip HEAD request
525522 $obj->stream( $output, $this->headersFromParams( $params ) );
526 - } catch ( InvalidResponseException $e ) {
527 - $status->fatal( 'backend-fail-connect', $this->name );
 523+ } catch ( InvalidResponseException $e ) { // 404? connection problem?
 524+ $status->fatal( 'backend-fail-stream', $params['src'] );
528525 } catch ( Exception $e ) { // some other exception?
529526 $status->fatal( 'backend-fail-stream', $params['src'] );
530527 $this->logException( $e, __METHOD__, $params );

Sign-offs

UserFlagDate
😂inspected21:42, 24 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   12:05, 16 January 2012

False -> false.

#Comment by 😂 (talk | contribs)   21:44, 24 January 2012

Fixed as part of r109428.

#Comment by Aaron Schulz (talk | contribs)   18:53, 16 January 2012

For some reason php-cloudfiles uses False...I ended up using that without noticing.

Status & tagging log