Skip to content

Commit

Permalink
Move select tick time to 1ms rather than 100ms
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdalitz committed Nov 16, 2024
1 parent 35005f6 commit 168a533
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dnsruby/select_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def do_select
send_queued_exceptions
send_queued_responses
send_queued_validation_responses
timeout = tick_time = 0.1 # We provide a timer service to various Dnsruby classes
timeout = tick_time = 0.001 # We provide a timer service to various Dnsruby classes
sockets, timeouts, has_observer = @@mutex.synchronize { [@@sockets.to_a, @@timeouts.values, !@@observers.empty?] }
if (timeouts.length > 0)
timeouts.sort!
Expand Down Expand Up @@ -221,7 +221,7 @@ def do_select
# process_error(errors)
end
@@mutex.synchronize do
if (unused_loop_count > 10 && @@query_hash.empty? && @@observers.empty?)
if (unused_loop_count > 1000 && @@query_hash.empty? && @@observers.empty?)
Dnsruby.log.debug("Try stop select loop")

non_persistent_sockets = @@sockets.select { |s| ! @@socket_is_persistent[s] }
Expand Down

0 comments on commit 168a533

Please sign in to comment.