Sha256: d418aa79aeb9af3dd958ece868337d3af5a4b351e95ea21a35d1ba12b0d532ed
Contents?: true
Size: 679 Bytes
Versions: 32
Compression:
Stored size: 679 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.tap do |result| raise result if result.is_a?(::Exception) end else super(sql, opts) end end end end end end
Version data entries
32 entries across 32 versions & 3 rubygems