Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cannot yield from root fiber" when used with EM.synchrony #22

Open
JohnMerlino1 opened this issue Sep 23, 2016 · 2 comments
Open

"cannot yield from root fiber" when used with EM.synchrony #22

JohnMerlino1 opened this issue Sep 23, 2016 · 2 comments

Comments

@JohnMerlino1
Copy link

I am trying to work with an ActiveRecord object on the callback but I get the error "cannot yield from root fiber":

EM.synchrony do
  User.all.each do |user|
    client = EM::IMAP.new('imap.gmail.com',993,true)

    client.connect.bind! do
          delegate.login(user.email, user.password)
    end.bind! do
          delegate.select('INBOX')
    end.bind! do
          delegate.search('1:20')
    end.bind! do |ids|
          delegate.fetch(ids, "(UID ENVELOPE BODY[TEXT])")
    end.callback do |msgs|
          user.update_attributes body: msgs.attr["BODY[TEXT]"] # Error here: cannot yield from root fiber
    end 
  end  
end

Why does this happen and how can I resolve it?

@ConradIrwin
Copy link
Owner

Hi @JohnMerlino1, I'm not sure exactly. Unfortunately I haven't used this library in over 4 years, so can't immediately think of anything.

Please let me know if anything comes up.

P.S. What are you trying to build? Looks like fun!

@JohnMerlino1
Copy link
Author

@ConradIrwin I am just trying to understand how the fibers are working. I asked the question on stackoverflow: http://stackoverflow.com/questions/39670727/asynchronous-programming-with-fibers Perhaps you can offer some insights. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants