Skip to content

Commit 30969c8

Browse files
Merge branch 'main' into fix-busy_handler_timeout-tests
2 parents 06086b7 + 5361528 commit 30969c8

1 file changed

Lines changed: 0 additions & 20 deletions

File tree

lib/sqlite3/database.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def initialize file, options = {}, zvfs = nil
131131
@type_translator = make_type_translator @type_translation
132132
@readonly = mode & Constants::Open::READONLY != 0
133133
@default_transaction_mode = options[:default_transaction_mode] || :deferred
134-
@timeout_deadline = nil
135134

136135
if block_given?
137136
begin
@@ -699,25 +698,6 @@ def readonly?
699698
@readonly
700699
end
701700

702-
# Sets a #busy_handler that releases the GVL between retries,
703-
# but only retries up to the indicated number of +milliseconds+.
704-
# This is an alternative to #busy_timeout, which holds the GVL
705-
# while SQLite sleeps and retries.
706-
def busy_handler_timeout=( milliseconds )
707-
timeout_seconds = milliseconds.fdiv(1000)
708-
709-
busy_handler do |count|
710-
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
711-
if count.zero?
712-
@timeout_deadline = now + timeout_seconds
713-
elsif now > @timeout_deadline
714-
next false
715-
else
716-
sleep(0.001)
717-
end
718-
end
719-
end
720-
721701
# A helper class for dealing with custom functions (see #create_function,
722702
# #create_aggregate, and #create_aggregate_handler). It encapsulates the
723703
# opaque function object that represents the current invocation. It also

0 commit comments

Comments
 (0)