-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Improve deadlock handling on ack()
and reject()
#54105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
use Doctrine\DBAL\Platforms\MySQLPlatform; | ||
use Doctrine\DBAL\Platforms\OraclePlatform; | ||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform; | ||
use Doctrine\DBAL\Query\ForUpdate\ConflictResolutionMode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as far as i can see, this was added in dbal 3.8, but we support versions prior to that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may have to manually construct the sql, as is done below with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will see. The sql for each platform is not as simple as just appending SKIP LOCKED. And in fact now that you point it out, I suspect this code might be broken for other platforms when you are using older versions of doctrine/dbal where the forUpdate() abstraction does not exist yet. |
||
use Doctrine\DBAL\Query\QueryBuilder; | ||
use Doctrine\DBAL\Result; | ||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
|
@@ -186,15 +187,22 @@ public function get(): ?array | |
->setParameters($query->getParameters(), $query->getParameterTypes()); | ||
|
||
if (method_exists(QueryBuilder::class, 'forUpdate')) { | ||
$query->forUpdate(); | ||
$query->forUpdate(ConflictResolutionMode::SKIP_LOCKED); | ||
} | ||
|
||
$sql = $query->getSQL(); | ||
} elseif (method_exists(QueryBuilder::class, 'forUpdate')) { | ||
$query->forUpdate(); | ||
$query->forUpdate(ConflictResolutionMode::SKIP_LOCKED); | ||
try { | ||
$sql = $query->getSQL(); | ||
} catch (DBALException $e) { | ||
// If SKIP_LOCKED is not supported, fallback to without SKIP_LOCKED | ||
$query->forUpdate(); | ||
|
||
try { | ||
$sql = $query->getSQL(); | ||
} catch (DBALException $e) { | ||
} | ||
} | ||
} elseif (preg_match('/FROM (.+) WHERE/', (string) $sql, $matches)) { | ||
$fromClause = $matches[1]; | ||
|
Uh oh!
There was an error while loading. Please reload this page.