Skip to content
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

[dbal] handle gracefully concurrency issues or 3rd party interruptions. #640

Merged
merged 1 commit into from
Nov 16, 2018

Conversation

makasim
Copy link
Member

@makasim makasim commented Nov 16, 2018

fixes #638

@@ -73,8 +74,9 @@ protected function fetchMessage(array $queues, int $redeliveryDelay): ?DbalMessa
->fetch()
;

// the message has been removed by a 3rd party, such as truncate operation.
if (false == $deliveredMessage) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== is probably intended here

@makasim makasim merged commit 815083c into master Nov 16, 2018
@makasim makasim deleted the dbal-do-not-fail-on-consumption branch November 16, 2018 15:38

$this->redeliverMessagesLastExecutedAt = microtime(true);
$this->redeliverMessagesLastExecutedAt = microtime(true);
} catch (DeadlockException $e) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to use \Doctrine\DBAL\Exception\RetryableException that I created. this would also cover lock timeouts.

@Tobion
Copy link

Tobion commented Nov 16, 2018

if ($update->execute()) {
can also cause errors likely that you should catch. I'd suggest to put the whole fetchMessage logic into a try ... catch (RetryableException $e)

@makasim
Copy link
Member Author

makasim commented Nov 16, 2018

@Tobion #642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dbal] consumer should still work if table is truncated
2 participants