Merge "content: Recognise .json as JsonContent in User and MediaWiki namespace"
[lhc/web/wiklou.git] / includes / poolcounter / PoolCounterRedis.php
index d609f61..98797a3 100644 (file)
@@ -121,19 +121,26 @@ class PoolCounterRedis extends PoolCounter {
        }
 
        function acquireForMe() {
-               $section = new ProfileSection( __METHOD__ );
+
+               $status = $this->precheckAcquire();
+               if ( !$status->isGood() ) {
+                       return $status;
+               }
 
                return $this->waitForSlotOrNotif( self::AWAKE_ONE );
        }
 
        function acquireForAnyone() {
-               $section = new ProfileSection( __METHOD__ );
+
+               $status = $this->precheckAcquire();
+               if ( !$status->isGood() ) {
+                       return $status;
+               }
 
                return $this->waitForSlotOrNotif( self::AWAKE_ALL );
        }
 
        function release() {
-               $section = new ProfileSection( __METHOD__ );
 
                if ( $this->slot === null ) {
                        return Status::newGood( PoolCounter::NOT_LOCKED ); // not locked
@@ -207,6 +214,8 @@ LUA;
                $this->onRelease = null;
                unset( self::$active[$this->session] );
 
+               $this->onRelease();
+
                return Status::newGood( PoolCounter::RELEASED );
        }
 
@@ -266,6 +275,8 @@ LUA;
                        self::$active[$this->session] = $this;
                }
 
+               $this->onAcquire();
+
                return Status::newGood( $slot === 'w' ? PoolCounter::DONE : PoolCounter::LOCKED );
        }