Merge branch 'master' into dashboard_river

* master:
  Attempting to add logging to socket.io.
  Reloading feeds when adding a subscription.
This commit is contained in:
Samuel Clay 2016-12-05 13:50:36 -08:00
commit d4daf1ac5a
3 changed files with 11 additions and 2 deletions

View file

@ -384,6 +384,10 @@ class UserSubscription(models.Model):
feed.setup_feed_for_premium_subscribers()
feed.count_subscribers()
r = redis.Redis(connection_pool=settings.REDIS_PUBSUB_POOL)
r.publish(user.username, 'reload:feeds')
return code, message, us

View file

@ -53,8 +53,11 @@ io.on 'connection', (socket) ->
socket.subscribe = redis.createClient 6379, REDIS_SERVER
socket.subscribe.on "error", (err) ->
console.log " ---> Error: #{err}"
socket.subscribe.quit()
socket.subscribe?.quit()
socket.subscribe.on "connect", =>
log.info @username, "Connected (#{@feeds.length} feeds, #{ip})," +
" (#{io.engine.clientsCount} connected) " +
" #{if SECURE then "(SSL)" else "(non-SSL)"}"
socket.subscribe.subscribe @feeds
socket.subscribe.subscribe @username

View file

@ -55,11 +55,13 @@
}
socket.subscribe = redis.createClient(6379, REDIS_SERVER);
socket.subscribe.on("error", function(err) {
var _ref1;
console.log(" ---> Error: " + err);
return socket.subscribe.quit();
return (_ref1 = socket.subscribe) != null ? _ref1.quit() : void 0;
});
socket.subscribe.on("connect", (function(_this) {
return function() {
log.info(_this.username, ("Connected (" + _this.feeds.length + " feeds, " + ip + "),") + (" (" + io.engine.clientsCount + " connected) ") + (" " + (SECURE ? "(SSL)" : "(non-SSL)")));
socket.subscribe.subscribe(_this.feeds);
return socket.subscribe.subscribe(_this.username);
};