From 4fa0d412023ffdefc4ba63eecccd4b74e712ff7d Mon Sep 17 00:00:00 2001 From: Daenney Date: Sat, 14 Sep 2024 16:36:25 +0200 Subject: [chore] Update go-sqlite3 to 0.18.3 (#3295) * [chore] Update go-sqlite3 to 0.18.3 * [chore] Fix getting the sqlite3.Conn --- vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go') diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go index 7425b5581..4cad777d3 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go @@ -38,9 +38,9 @@ func osGetPendingLock(file *os.File, block bool) _ErrorCode { return osWriteLock(file, _PENDING_BYTE, 1, timeout) } -func osGetExclusiveLock(file *os.File, wait bool) _ErrorCode { +func osGetExclusiveLock(file *os.File, block bool) _ErrorCode { var timeout time.Duration - if wait { + if block { timeout = time.Millisecond } @@ -134,10 +134,11 @@ func osLock(file *os.File, flags, start, len uint32, timeout time.Duration, def if errno, _ := err.(windows.Errno); errno != windows.ERROR_LOCK_VIOLATION { break } - if timeout < time.Since(before) { + if time.Since(before) > timeout { break } - time.Sleep(time.Duration(rand.Int63n(int64(time.Millisecond)))) + const sleepIncrement = 1024*1024 - 1 // power of two, ~1ms + time.Sleep(time.Duration(rand.Int63() & sleepIncrement)) } } return osLockErrorCode(err, def) -- cgit v1.2.3