Skip to content

Latest commit

 

History

54 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doctrine Deadlock Retry Bundle

CI Packagist Version Packagist Downloads License PHP Symfony GitHub stars Coverage

Found this useful? Install from Packagist and give it a star on GitHub.

Symfony bundle that retries EntityManager::flush() and custom operations when Doctrine DBAL raises a deadlock (SQLSTATE[40001], MySQL error 1213).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

Features

  • DeadlockRetryService: flush(?string $profile) and retry(callable $operation, ?string $profile).
  • Named profiles: configure max_retries, sleep_ms, and rollback_on_deadlock per use case.
  • Default profile: used when no profile name is passed.
  • Detects DeadlockException and related driver errors in the exception chain.

Version policy

The Composer package is nowo-tech/doctrine-deadlock-retry-bundle. Source and issues: nowo-tech/DoctrineDeadlockRetryBundle.

We follow Semantic Versioning. See Changelog. Security support is described in the Security policy.

Quick example

use Nowo\DoctrineDeadlockRetryBundle\Service\DeadlockRetryService;

public function __construct(
    private readonly DeadlockRetryService $deadlockRetry,
) {
}

public function save(Order $order): void
{
    $this->entityManager->persist($order);
    $this->deadlockRetry->flush();
    $this->deadlockRetry->flush('batch');
}

Requirements

  • PHP >= 8.2, < 8.6 (Symfony 8.x requires PHP 8.4+)
  • Symfony 6.0+ | 7.4+ | 8.0+ | 8.1+ (minimum tested minors: 7.4, 8.0, 8.1)
  • Doctrine ORM and DoctrineBundle

Documentation

Additional documentation

Tests and coverage

  • Tests: PHPUnit (PHP)
  • PHP: 100%

License

MIT. See LICENSE.

About

Symfony bundle that retries EntityManager flush and custom operations when Doctrine DBAL raises a deadlock (SQLSTATE 40001, MySQL 1213).

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages