From: Aaron Schulz Date: Thu, 12 May 2016 22:52:56 +0000 (-0700) Subject: Increase LocalFile lock() timeout and improve error message X-Git-Tag: 1.31.0-rc.0~6949^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=e702a7008252f4881933058a12fc389d0a0506d8;p=lhc%2Fweb%2Fwiklou.git Increase LocalFile lock() timeout and improve error message Bug: T132921 Change-Id: Iaec861475b4b6ec91a824672fb81ed5a8eb2b6a9 --- diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index f7275fc02c..2a15fd7ab6 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1920,12 +1920,15 @@ class LocalFile extends File { // Also, that would cause contention on INSERT of similarly named rows. $backend = $this->getRepo()->getBackend(); $lockPaths = [ $this->getPath() ]; // represents all versions of the file - $status = $backend->lockFiles( $lockPaths, LockManager::LOCK_EX, 5 ); + $start = microtime( true ); + $status = $backend->lockFiles( $lockPaths, LockManager::LOCK_EX, 10 ); + $waited = microtime( true ) - $start; if ( !$status->isGood() ) { if ( $this->lockedOwnTrx ) { $dbw->rollback( __METHOD__ ); } - throw new LocalFileLockError( "Could not acquire lock for '{$this->getName()}.'" ); + throw new LocalFileLockError( + "Could not acquire lock for '{$this->getName()}' ($waited sec)." ); } // Release the lock *after* commit to avoid row-level contention $this->locked++;