Module: Mysql2::Fibered::Client::Watcher

Defined in:
lib/active_record/connection_adapters/em_mysql2_adapter.rb

Instance Method Summary collapse

Instance Method Details

#initialize(client, deferable) ⇒ Object



27
28
29
30
# File 'lib/active_record/connection_adapters/em_mysql2_adapter.rb', line 27

def initialize(client, deferable)
  @client = client
  @deferable = deferable
end

#notify_readableObject



32
33
34
35
36
37
38
39
40
# File 'lib/active_record/connection_adapters/em_mysql2_adapter.rb', line 32

def notify_readable
  begin
    detach
    results = @client.async_result
    @deferable.succeed(results)
  rescue Exception => e
    @deferable.fail(e)
  end
end