Skip to content

Commit

Permalink
Merge pull request #18 from marcojanssen/release-pdo-connection
Browse files Browse the repository at this point in the history
Disconnect when lock is released
  • Loading branch information
arvenil committed Sep 10, 2015
2 parents 6bc68b4 + 3a32b94 commit 9726729
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/NinjaMutex/Lock/MySqlLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function releaseLock($name)
return false;
}

unset($this->pdo[$name]);
unset($this->locks[$name]);

return true;
Expand Down Expand Up @@ -156,4 +157,13 @@ protected function setupPDO($name)

return true;
}

public function __destruct()
{
parent::__destruct();

foreach($this->pdo as $name => $pdo) {
unset($this->pdo[$name]);
}
}
}

0 comments on commit 9726729

Please sign in to comment.