Sha256: 6c10f7f33f1e3a68aa4d839e75daf6359c36100d85b1f0c7b596bd53e19c2914
Contents?: true
Size: 591 Bytes
Versions: 3
Compression:
Stored size: 591 Bytes
Contents
# encoding: utf-8 require 'mysql2/em' require 'fiber' module Mysql2 module EM module Fiber class Client < ::Mysql2::EM::Client def query(sql, opts={}) if ::EM.reactor_running? deferable = super(sql, opts) fiber = ::Fiber.current deferable.callback do |result| fiber.resume(result) end deferable.errback do |err| fiber.resume(err) end ::Fiber.yield else super(sql, opts) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ghazel-mysql2-0.2.6.3 | lib/mysql2/em_fiber.rb |
ghazel-mysql2-0.2.6.2 | lib/mysql2/em_fiber.rb |
ghazel-mysql2-0.2.6.1 | lib/mysql2/em_fiber.rb |