Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Detach EM.watch from close(). #265

Merged
merged 1 commit into from

2 participants

@ab
ab commented

Fixes #264

@brianmario brianmario merged commit 5098c81 into brianmario:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2012
  1. @ab

    Detach EM.watch from close().

    ab authored
    Fixes #264
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/mysql2/em.rb
View
10 lib/mysql2/em.rb
@@ -24,11 +24,19 @@ def notify_readable
end
end
+ def close(*args)
+ if @watch
+ @watch.detach
+ end
+ super(*args)
+ end
+
def query(sql, opts={})
if ::EM.reactor_running?
super(sql, opts.merge(:async => true))
deferable = ::EM::DefaultDeferrable.new
- ::EM.watch(self.socket, Watcher, self, deferable).notify_readable = true
+ @watch = ::EM.watch(self.socket, Watcher, self, deferable)
+ @watch.notify_readable = true
deferable
else
super(sql, opts)
Something went wrong with that request. Please try again.