Closed lpender closed 10 years ago
Sorry I'm slow on responding or looking into the issues. (I'm currently on vacation.)
My guess is the fake server isn't being killed before or after the server is shutdown for some reason. Did you check to see if there are any stray Ruby processes running after?
No worries, thanks for responding at all!
Thanks for the suggestion, I do see lingering ruby
processes and kill them now, which is helpful.
That said, I don't think I'm getting to the underlying problem.
I'm starting to think that my approach is fundamentally wrong in trying to use PusherFake
in the development
environment.
I am trying to do this because my RSpec
tests are failing (though I tried my best to translate them from your Cucumber
tests), and I want to see if I can reproduce their failures in the development
environment.
I've forked your pusher-fake-example
repository and added two commits:
1) Update dependencies to the latest.
2) Attempt to use PusherFake
in development
.
The second commit doesn't work for me, it gives me the message Bad request: Unknown path: /apps/PUSHER_APP_ID/events
when I visit localhost:3000
.
I'd love it if you had time to take a look at the second commit and tell me if I have an error in my reasoning, or if you think that PusherFake
simply shouldn't be used in development
.
Thanks! -Lee
I figured out the problem: PusherFake
is being started in both my web
and my worker
processes from my Procfile
. Still working on a solution...
Ah dang. Only quick solution I can think of is to add an environment flag to one process line and only run it when set, but maybe a little bit of a hack.
Thinking it would be nice to be able to start the PusherFake server as its own rake
task, but still struggling with the implementation...
In retrospect, I think the rake
task is unlikely because of the cross-talk required between Pusher
and Pusher-Fake
...
That said, this seems to fix the issue:
config/initializers/pusher.rb
if Rails.env.development? && ENV["IS_WEB_DYNO"]
require "pusher-fake/support/base"
end
Procfile
web: IS_WEB_DYNO=TRUE bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec rake jobs:work
...
Also, a caveat is that it appears that I have to log out/log back in to each account after restarting the server for it to work properly.
Thanks! -Lee
I'd like a better way to support this, since my intentions are for it to work in development, but I'm still not sure of a better solution than this. I made a note of your solution in the README. (354134a3984339dea11a0cf7b5faef783ec885bf) Going to close this for now, but feel free to reopen if you find a better solution.
Also, a caveat is that it appears that I have to log out/log back in to each account after restarting the server for it to work properly.
I assume that's because the connection and user information is lost when it's restarted.
Hi,
I know I've opened quite a few issues in the last few days. Don't want to hog the microphone, but I thought this might be helpful to you.
I am trying to use
PusherFake
in my development environment, though I'm not sure if that's intended usage.Note: I made this change to
server.rb:37
, as part of my debugging processHere are my local files:
development.rb
And here is the result that I get in my server logs (it returns similar result for any open port)
https://gist.github.com/lpender/148700fc8d98e6ab4cbd
A couple more points of interest:
foreman
withCtrl-D