-
Notifications
You must be signed in to change notification settings - Fork 151
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
em-synchrony retuns nil inside of Thin, with aget, without aget. #152
Comments
Can you replace |
@richo what do you mean? I'll have to create a local no matter what even with an array. |
def get
out = []
if !EventMachine.reactor_running?
EventMachine.run do
Fiber.new do
out << Response.new(@url.dup.get)
EventMachine.stop
end.resume
end
else
Fiber.new do
out << Response.new(@url.dup.get)
end.resume
end
out.pop
end Almost certainly barking up the wrong tree, I seem to recall there being some weird instance_exec magic that may be creating more scope than you're expecting. This just guarantees that you're mutating the closed over |
@richo didn't work :( and I'm stuck in a crappy situation with this too because Unicorn just doesn't work out well for restarting on file change in development and I can't get Thin + EM to do http requests right, and Puma is broken on jRuby w/ SSL >.< sad day. |
You can cheat with unicorn, use Guard to send USR2 to the master every time there are fs changes with preload_app :false? That's kinda shitty but it sounds like your best option right now. That said, unicorn and jruby sounds like Doing It Wrong. |
Trinidad+jRuby in production/staging -- Thin+MRI on development (my development)... puma came about so that we could kinda bring the two together with a server that works on both without me having to build in certain key pieces to account for Thin quirks... so the comment does seem out of place but it's fitting kinda. |
Running the above code in a Fiber in Pry works perfectly, running it inside of Thin results in an
nil
value, actually the oddest part is it replaces@url
withnil
so I had to start duping just so I could figure out what's going on, but I couldn't. Even when I run the examples from: https://github.com/igrigorik/em-http-request/blob/master/examples/fibered-http.rb inside of Thin, I get the same nil result. Am I doing it wrong?The text was updated successfully, but these errors were encountered: