- Notifications
You must be signed in to change notification settings - Fork0
A modified version of the MySQL Dialect for Kysely with deadlock retries.
License
NotificationsYou must be signed in to change notification settings
thelinuxlich/mysql-dialect-with-deadlock-retries
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A custom MySQL dialect forKysely that automatically retries queries when they encounter deadlock errors.
- 🔄 Automatic retry of queries that fail due to deadlocks
- ⚙️ Configurable retry attempts, exponential backoff and delay
- 📊 Optional retry tracking and logging
- 🔌 Drop-in replacement for Kysely's standard MySQL dialect
npm install mysql-dialect-with-deadlock# orpnpm add mysql-dialect-with-deadlockimport{Kysely}from'kysely'import{createPool}from'mysql2'import{MySQLDialectWithDeadlockRetries}from'mysql-dialect-with-deadlock'constdb=newKysely({dialect:newMySQLDialectWithDeadlockRetries({pool:createPool({host:'localhost',user:'root',database:'test'}),deadlock:{maxAttempts:3,onRetry:(error,attempt)=>{console.log(`Retry attempt${attempt} after deadlock:${error.message}`)}}})})
| Option | Type | Default | Description |
|---|---|---|---|
maxAttempts | number | 3 | Maximum number of retry attempts |
delay | number | 0 | Delay in ms between retries |
backoff | boolean | false | Use exponential backoff for delays |
onRetry | function | undefined | Callback function called on each retry |
MIT
About
A modified version of the MySQL Dialect for Kysely with deadlock retries.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.