RS, DG; Log files should now rotate

This commit is contained in:
Raphael 2010-08-09 14:27:17 -07:00
parent 088da2544b
commit 614c8c72ba
3 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,5 @@
development:
debug: true
debug: false
socket_port: 8080
pubsub_server: 'https://pubsubhubbub.appspot.com/'

View file

@ -0,0 +1,2 @@
Rails.logger = Logger.new(
Rails.root.join("log",Rails.env + ".log"),3,5*1024*1024)

View file

@ -25,12 +25,13 @@ module WebSocket
end
def self.push_to_user(uid, data)
puts "Pushing to #{uid}"
puts @channels.size
Rails.logger.info "Pushing to #{uid}"
@channels[uid.to_s][0].push(data) if @channels[uid.to_s]
end
def self.subscribe(uid, ws)
puts "Subscribing #{uid}"
puts "Subscribing socket to #{User.first(:id => uid).email}"
self.ensure_channel(uid)
@channels[uid][0].subscribe{ |msg| ws.send msg }
@channels[uid][1] += 1
@ -41,6 +42,7 @@ module WebSocket
end
def self.unsubscribe(uid,sid)
puts "Unsubscribing socket #{sid} from #{User.first(:id => uid).email}"
@channels[uid][0].unsubscribe(sid) if @channels[uid]
@channels[uid][1] -= 1
if @channels[uid][1] <= 0