From e2b3038074a5b18ca6acbe67bfeecd449d97ecc3 Mon Sep 17 00:00:00 2001 From: Ross Light Date: Fri, 2 Feb 2024 09:06:05 -0800 Subject: [PATCH] Make busy-blocking more responsive Fixes #75 --- CHANGELOG.md | 7 +++++++ sqlite.go | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87295a1..82385ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [Unreleased]: https://github.com/zombiezen/go-sqlite/compare/v1.1.0...main +## [Unreleased][] + +### Fixed + +- Make busy-blocking more responsive + ([#75](https://github.com/zombiezen/go-sqlite/issues/75)). + ## [1.1.0][] - 2024-01-14 Version 1.1 introduces the ability to prepare connections on `sqlitex.Pool`, diff --git a/sqlite.go b/sqlite.go index 9504883..b9d1e30 100644 --- a/sqlite.go +++ b/sqlite.go @@ -336,6 +336,22 @@ func (c *Conn) SetBlockOnBusy() { } var busyDelays = [...]time.Duration{ + 1 * time.Millisecond, + 2 * time.Millisecond, + 5 * time.Millisecond, + 10 * time.Millisecond, + 15 * time.Millisecond, + 20 * time.Millisecond, + 25 * time.Millisecond, + 25 * time.Millisecond, + 25 * time.Millisecond, + 50 * time.Millisecond, + 50 * time.Millisecond, + 100 * time.Millisecond, + 250 * time.Millisecond, + 250 * time.Millisecond, + 500 * time.Millisecond, + 1 * time.Second, 2 * time.Second, 5 * time.Second,