Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Disconnect method #38

Merged
merged 1 commit into from

2 participants

@amalhotra

I was running a process that would login to gmail parse messages, logout and repeat. Unfortunately the number of open TCP sockets for this process kept increasing with time and at some point (hours later) my process crashed with a Too many open connections error.

Added a disconnect method which basically calls @imap.disconnect. Let me know if you need me to tweak it. Thanks for the library.

@myobie myobie merged commit aff69cf into dcparker:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 12, 2011
  1. @amalhotra
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/gmail.rb
View
6 lib/gmail.rb
@@ -105,6 +105,12 @@ def logout
@logged_in = false if res.name == 'OK'
end
end
+
+ # Shutdown socket and disconnect
+ def disconnect
+ logout if logged_in?
+ @imap.disconnect unless @imap.disconnected?
+ end
def in_mailbox(mailbox, &block)
if block_given?
Something went wrong with that request. Please try again.