class Amalgalite::BusyTimeout
A busy time out class for use in Amalgalite::Database#define_busy_handler
Attributes
call_count[R]
Public Class Methods
new( count = 20 , duration = 50 )
click to toggle source
intialize by setting count and duration ( in milliseconds ).
# File lib/amalgalite/busy_timeout.rb, line 30 def initialize( count = 20 , duration = 50 ) @count = count @duration = duration.to_f / 1_000 @call_count = 0 end
Public Instance Methods
call( call_count )
click to toggle source
return false
if callcount is > count
otherwise sleep for duration milliseconds and then return
true
# File lib/amalgalite/busy_timeout.rb, line 40 def call( call_count ) @call_count = call_count return false if ( call_count > @count ) sleep @duration return true end