Skip to content

Commit

Permalink
Update database.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
fractaledmind committed Dec 29, 2023
1 parent 6ef4db2 commit 17c9db8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/sqlite3/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -697,13 +697,12 @@ def readonly?
# while SQLite sleeps and retries.
def busy_handler_timeout=( milliseconds )
timeout_seconds = milliseconds.fdiv(1000)
retry_interval = 0.001 # 1 millisecond
timeout_deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout_seconds

busy_handler do |count|
next false if Process.clock_gettime(Process::CLOCK_MONOTONIC) > timeout_deadline

sleep(retry_interval)
sleep(0.001)
end
end

Expand Down

0 comments on commit 17c9db8

Please sign in to comment.