rescue redis connection attempts in websocket
This commit is contained in:
parent
8821043ed7
commit
55d39521c4
3 changed files with 23 additions and 2 deletions
|
|
@ -5,10 +5,16 @@ require 'resque'
|
|||
|
||||
begin
|
||||
if Diaspora::Application.config.work_in_process
|
||||
if Rails.env == 'production'
|
||||
puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this."
|
||||
end
|
||||
|
||||
module Resque
|
||||
def enqueue(klass, *args)
|
||||
klass.send(:perform, *args)
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
|
|
|||
|
|
@ -60,11 +60,19 @@ module Diaspora
|
|||
|
||||
module Socketable
|
||||
def socket_to_user(user_or_id, opts={})
|
||||
SocketsController.new.outgoing(user_or_id, self, opts)
|
||||
begin
|
||||
SocketsController.new.outgoing(user_or_id, self, opts)
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def unsocket_from_user(user_or_id, opts={})
|
||||
SocketsController.new.outgoing(user_or_id, Retraction.for(self), opts)
|
||||
begin
|
||||
SocketsController.new.outgoing(user_or_id, Retraction.for(self), opts)
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,4 +63,11 @@ describe Diaspora::Socketable do
|
|||
Diaspora::WebSocket.should_receive(:queue_to_user)
|
||||
@post.socket_to_user(@user, :aspect_ids => @aspect.id)
|
||||
end
|
||||
|
||||
it 'no-ops if redis isnt present' do
|
||||
Diaspora::WebSocket.stub(:redis).and_return(nil)
|
||||
lambda {
|
||||
@post.socket_to_user(@user, :aspect_ids => @aspect.id)
|
||||
}.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue