Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 41b835a

Browse filesBrowse files
committed
[Lock] MysqlStore::putOffExpiration ping the connection to ensure it is alive
1 parent c0f10a4 commit 41b835a
Copy full SHA for 41b835a

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed

‎src/Symfony/Component/Lock/Store/MysqlStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/MysqlStore.php
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function waitAndSave(Key $key)
7171

7272
private function lock(Key $key, bool $blocking)
7373
{
74-
// The lock is maybe already acquired.
74+
// the lock is maybe already acquired.
7575
if ($key->hasState(__CLASS__)) {
7676
return;
7777
}
@@ -102,7 +102,7 @@ private function lock(Key $key, bool $blocking)
102102
}
103103

104104
// store the release statement in the state
105-
$releaseStmt = $this->connection->prepare('SELECT RELEASE_LOCK(:key)');
105+
$releaseStmt = $this->connection->prepare('DO RELEASE_LOCK(:key)');
106106
$releaseStmt->bindValue(':key', $storedKey, \PDO::PARAM_STR);
107107

108108
$key->setState(__CLASS__, $releaseStmt);
@@ -113,7 +113,9 @@ private function lock(Key $key, bool $blocking)
113113
*/
114114
public function putOffExpiration(Key $key, $ttl)
115115
{
116-
// do nothing, the GET_LOCK locks forever, until the session terminates.
116+
// the GET_LOCK locks forever, until the session terminates.
117+
// keep the session open
118+
$this->connection->exec('DO 1');
117119
}
118120

119121
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.