Class: Droonga::Client::Connection::DroongaProtocol::Coolio::InfiniteRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/client/connection/droonga-protocol/coolio.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loop, options = {}) ⇒ InfiniteRequest

Returns a new instance of InfiniteRequest.



53
54
55
56
# File 'lib/droonga/client/connection/droonga-protocol/coolio.rb', line 53

def initialize(loop, options={})
  @loop = loop
  @subscription_timeout = options[:subscription_timeout]
end

Instance Attribute Details

#on_timeout=(value) ⇒ Object (writeonly)

Sets the attribute on_timeout

Parameters:

  • value

    the value to set the attribute on_timeout to.



51
52
53
# File 'lib/droonga/client/connection/droonga-protocol/coolio.rb', line 51

def on_timeout=(value)
  @on_timeout = value
end

Instance Method Details

#waitObject



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/droonga/client/connection/droonga-protocol/coolio.rb', line 58

def wait
  if @subscription_timeout
    @timer = Coolio::TimerWatcher.new(@subscription_timeout)
    @timer.on_timer do
      @timer.detach
      @on_timeout.call if @on_timeout
    end
    @loop.attach(@timer)
  end
  @loop.run
end