Releases: Ahed92Wakim/laravel-db-transaction-retry
Simplifies retry configuration for deadlocks and timeouts
-
Breaking – Removed the retryable_exceptions config array entirely; deadlock (40001 / 1213) and lock-wait timeout (1205) retries are now controlled solely by the retry_on_deadlock and retry_on_lock_wait_timeout booleans. Any previously published config that referenced retryable_exceptions.* must be updated.
-
Behavioral – The retrier now retries based on those toggles only, automatically handling SQLSTATE-only deadlocks and lock-wait driver codes without extra config.
-
Behavioral – The lock-wait timeout override still runs only when retry_on_lock_wait_timeout is enabled, ensuring session statements remain opt-in.
-
Docs/Tests – README rewritten to match the streamlined options, and the Pest suite updated to cover the new retry rules and edge cases.
Adds runtime toggle to enable/disable retries
Introduces Artisan commands to enable/disable database transaction retries at runtime without modifying configuration files. This is achieved by creating/removing a marker file.
Adds RetryToggle class to handle the logic for checking and managing the marker file.
Updates the transaction retrier to respect the runtime toggle status.
v2.0.0 – Configurable Deadlock Retrier & Logging Overhaul
Breaking
- Replaced
DBTransactionRetryHelper::transactionWithRetry()with the newMysqlDeadlocks\RetryHelper\Services\DeadlockTransactionRetrier::runWithRetry(). Update imports/usages accordingly. - Package config now lives under
config/mysql-deadlock-retry.php; publish it withphp artisan vendor:publish --tag=mysql-deadlock-retry-configif you rely on defaults.
Highlights
- Added first-class configuration for retry counts, base delay, and log file naming, all overridable via env vars.
- Introduced
DeadlockTransactionRetrierservice with exponential backoff, jitter, request-aware logging context, and container-exposed transaction labels. - Delivered dedicated helpers (
DeadlockLogWriter,TraceFormatter,BindingStringifier) for consistent instrumentation and easier extension. - Updated README with usage samples, configuration guidance, and package badges.
Maintenance
- Switched the test suite to Pest and broadened coverage for retry scenarios, logging behaviour, and jitter math.
- Refreshed GitHub Actions workflow, coding standards config, and development dependencies.
What's Changed
- Add Test, Php-cs-fixer and CI workflows by @ZnarKhalil in #1
- Feature/test pr by @Ahed92Wakim in #2
- extends CI and update README.md by @Ahed92Wakim in #3
- Migrates tests from PHPUnit to Pest by @Ahed92Wakim in #4
- Feature/pest test by @Ahed92Wakim in #5
- Feature/update readme.md by @Ahed92Wakim in #6
- add logo by @Ahed92Wakim in #8
- Feature/file structure by @Ahed92Wakim in #10
New Contributors
- @ZnarKhalil made their first contribution in #1
- @Ahed92Wakim made their first contribution in #2
Full Changelog: 1.3.1...2.0.0
Don't log the none deadlock exception just throw it
Improves DB transaction retry logic do not log if non deadlock exception just throw it
improve logs
1.2.3 improve log
fix log-directory
1.2.1 Merge branch 'hotfix/fix-log'
improve retry logic
Updates dependencies and improves retry logic - Updates composer dependencies to newer versions, including Laravel 12 and PHP 8.2 - Refactors retry logic to include exponential backoff with jitter for more robust handling of deadlocks - Improves logging context with request details (URL, method, token, userId) when available, and includes full exception traces for debugging - Enhance logic to identify retryable deadlock/serialization failure errors