igrigorik / em-synchrony

Fiber aware EventMachine clients and convenience classes
http://www.igvita.com/2010/03/22/untangling-evented-code-with-ruby-fibers
MIT License
1.04k stars 151 forks source link

How to perform an imap call in a fiber iterator? #208

Open JohnMerlino1 opened 8 years ago

JohnMerlino1 commented 8 years ago

I am using the following:

require "em-synchrony"
require "em-synchrony/mysql2"
require "em-synchrony/activerecord"

I have three active_relation objects in an array:

   EM.synchrony do
     statuses = [
        User.very_frequent,
        User.frequent,
        User.infrequent
     ]
     ...

I then want to iterate through the collections and perform an imap call asynchronously using FiberIterator:

  EM::Synchrony::FiberIterator.new(statuses.size, @@pool_size).each do |i|
    status = statuses[i]
    status.each do |user|
      # imap stuff goes here
    end
  end
end

On the examples on the wiki and on the tests I saw, you use other asynchronous I/O such as TCP and HTTP. But is there an option for imap packed in this gem or another gem?

dgutov commented 8 years ago

Do you know an asynchronous IMAP library for Ruby?