Adding more logging around real-time updates to debug dashboard swallowing story updates.

This commit is contained in:
Samuel Clay 2020-12-17 18:09:38 -05:00
parent 58851d15d7
commit d18216e49d
3 changed files with 12 additions and 11 deletions

View file

@ -5088,7 +5088,7 @@
this.socket.on('feed:story:new', _.bind(function(feed_id, message) {
var story_hash = message.split(',')[0];
var timestamp = message.split(',')[1];
// NEWSBLUR.log(['Real-time new story', feed_id, story_hash, timestamp]);
NEWSBLUR.log(['Real-time new story', feed_id, story_hash, timestamp, message]);
if (NEWSBLUR.app.dashboard_rivers) {
NEWSBLUR.app.dashboard_rivers.map(function (r) { r.new_story(story_hash, timestamp); });
}

View file

@ -78,13 +78,13 @@ io.on 'connection', (socket) ->
socket.subscribe.subscribe @username
socket.subscribe.on 'message', (channel, message) =>
log.info @username, "Update on #{channel}: #{message}"
event_name = 'feed:update'
if channel == @username
socket.emit 'user:update', channel, message
event_name = 'user:update'
else if channel.indexOf(':story') >= 0
socket.emit 'feed:story:new', channel, message
else
socket.emit 'feed:update', channel, message
event_name = 'feed:story:new'
log.info @username, "Update on #{channel}: #{event_name} - #{message}"
socket.emit event_name, channel, message
socket.on 'disconnect', () =>
socket.subscribe?.quit()

View file

@ -98,14 +98,15 @@
return socket.subscribe.subscribe(this.username);
});
return socket.subscribe.on('message', (channel, message) => {
log.info(this.username, `Update on ${channel}: ${message}`);
var event_name;
event_name = 'feed:update';
if (channel === this.username) {
return socket.emit('user:update', channel, message);
event_name = 'user:update';
} else if (channel.indexOf(':story') >= 0) {
return socket.emit('feed:story:new', channel, message);
} else {
return socket.emit('feed:update', channel, message);
event_name = 'feed:story:new';
}
log.info(this.username, `Update on ${channel}: ${event_name} - ${message}`);
return socket.emit(event_name, channel, message);
});
});
return socket.on('disconnect', () => {