Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A custom MySQL dialect forKysely that automatically retries queries when they encounter deadlock errors.

Features

  • 🔄 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

Installation

npm install mysql-dialect-with-deadlock# orpnpm add mysql-dialect-with-deadlock

Usage

import{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}`)}}})})

Configuration

OptionTypeDefaultDescription
maxAttemptsnumber3Maximum number of retry attempts
delaynumber0Delay in ms between retries
backoffbooleanfalseUse exponential backoff for delays
onRetryfunctionundefinedCallback function called on each retry

License

MIT

About

A modified version of the MySQL Dialect for Kysely with deadlock retries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp