Skip to content

Commit 256f48a

Browse files
authored
Merge pull request #38238 from nextcloud/backport/37709/stable26
[stable26] fix: Check for wrapped retriable exceptions
2 parents 8d1c140 + 27bd9e2 commit 256f48a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/private/DB/Exceptions/DbalException.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use Doctrine\DBAL\Exception\InvalidFieldNameException;
3838
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
3939
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
40+
use Doctrine\DBAL\Exception\RetryableException;
4041
use Doctrine\DBAL\Exception\ServerException;
4142
use Doctrine\DBAL\Exception\SyntaxErrorException;
4243
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
@@ -74,6 +75,10 @@ public static function wrap(\Doctrine\DBAL\Exception $original, string $message
7475
);
7576
}
7677

78+
public function isRetryable(): bool {
79+
return $this->original instanceof RetryableException;
80+
}
81+
7782
public function getReason(): ?int {
7883
/**
7984
* Constraint errors

lib/private/Files/Cache/Propagator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace OC\Files\Cache;
2626

27-
use Doctrine\DBAL\Exception\RetryableException;
27+
use OC\DB\Exceptions\DbalException;
2828
use OC\Files\Storage\Wrapper\Encryption;
2929
use OCP\DB\QueryBuilder\IQueryBuilder;
3030
use OCP\Files\Cache\IPropagator;
@@ -136,7 +136,11 @@ public function propagateChange($internalPath, $time, $sizeDifference = 0) {
136136
try {
137137
$builder->executeStatement();
138138
break;
139-
} catch (RetryableException $e) {
139+
} catch (DbalException $e) {
140+
if (!$e->isRetryable()) {
141+
throw $e;
142+
}
143+
140144
/** @var LoggerInterface $loggerInterface */
141145
$loggerInterface = \OCP\Server::get(LoggerInterface::class);
142146
$loggerInterface->warning('Retrying propagation query after retryable exception.', [ 'exception' => $e ]);

0 commit comments

Comments
 (0)