mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix: Check for wrapped retriable exceptions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
c995428431
commit
3bdd770129
2 changed files with 11 additions and 2 deletions
|
|
@ -37,6 +37,7 @@ use Doctrine\DBAL\Exception\InvalidArgumentException;
|
|||
use Doctrine\DBAL\Exception\InvalidFieldNameException;
|
||||
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
|
||||
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
|
||||
use Doctrine\DBAL\Exception\RetryableException;
|
||||
use Doctrine\DBAL\Exception\ServerException;
|
||||
use Doctrine\DBAL\Exception\SyntaxErrorException;
|
||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||
|
|
@ -74,6 +75,10 @@ class DbalException extends Exception {
|
|||
);
|
||||
}
|
||||
|
||||
public function isRetryable(): bool {
|
||||
return $this->original instanceof RetryableException;
|
||||
}
|
||||
|
||||
public function getReason(): ?int {
|
||||
/**
|
||||
* Constraint errors
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace OC\Files\Cache;
|
||||
|
||||
use Doctrine\DBAL\Exception\RetryableException;
|
||||
use OC\DB\Exceptions\DbalException;
|
||||
use OC\Files\Storage\Wrapper\Encryption;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\Files\Cache\IPropagator;
|
||||
|
|
@ -136,7 +136,11 @@ class Propagator implements IPropagator {
|
|||
try {
|
||||
$builder->executeStatement();
|
||||
break;
|
||||
} catch (RetryableException $e) {
|
||||
} catch (DbalException $e) {
|
||||
if (!$e->isRetryable()) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/** @var LoggerInterface $loggerInterface */
|
||||
$loggerInterface = \OCP\Server::get(LoggerInterface::class);
|
||||
$loggerInterface->warning('Retrying propagation query after retryable exception.', [ 'exception' => $e ]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue