mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Refactoring real-time socketio clientside to fix multiple client updates.
This commit is contained in:
parent
48cab9ac20
commit
76cbbd8d8b
4 changed files with 43 additions and 38 deletions
|
@ -91,11 +91,11 @@ server {
|
|||
}
|
||||
|
||||
location /munin/ {
|
||||
alias /var/cache/munin/www/;
|
||||
# fastcgi_split_path_info ^(/munin)(.*);
|
||||
# fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
# fastcgi_pass unix:/var/run/munin/fcgi-html.sock;
|
||||
# include fastcgi_params;
|
||||
# alias /var/cache/munin/www/;
|
||||
fastcgi_split_path_info ^(/munin)(.*);
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_pass unix:/var/run/munin/fcgi-html.sock;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ^~ /cgi-bin/munin-cgi-graph/ {
|
||||
|
|
1
fabfile.py
vendored
1
fabfile.py
vendored
|
@ -876,6 +876,7 @@ def setup_munin():
|
|||
sudo('/etc/init.d/munin-node restart')
|
||||
with settings(warn_only=True):
|
||||
sudo('chown nginx.www-data munin-cgi*')
|
||||
sudo('chmod a+rw /var/log/munin/*')
|
||||
with settings(warn_only=True):
|
||||
sudo('/etc/init.d/spawn_fcgi_munin_graph start')
|
||||
sudo('/etc/init.d/spawn_fcgi_munin_html start')
|
||||
|
|
|
@ -3884,40 +3884,41 @@
|
|||
this.socket.on('connect', _.bind(function() {
|
||||
var active_feeds = this.send_socket_active_feeds();
|
||||
// NEWSBLUR.log(["Connected to real-time pubsub with " + active_feeds.length + " feeds."]);
|
||||
this.socket.removeAllListeners('feed:update');
|
||||
this.socket.on('feed:update', _.bind(function(feed_id, message) {
|
||||
NEWSBLUR.log(['Real-time feed update', feed_id, message]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}, this));
|
||||
|
||||
this.socket.removeAllListeners(NEWSBLUR.Globals.username);
|
||||
this.socket.on('user:update', _.bind(function(username, feed_id) {
|
||||
if (this.flags.social_view) return;
|
||||
if (_.string.contains(feed_id, 'feed:')) {
|
||||
feed_id = parseInt(feed_id.replace('feed:', ''), 10);
|
||||
var active_feed_ids = [];
|
||||
if (this.active_folder && this.active_folder.length) {
|
||||
active_feed_ids = this.active_folder.feed_ids_in_folder();
|
||||
}
|
||||
if (feed_id != this.active_feed &&
|
||||
!_.contains(active_feed_ids, feed_id)) {
|
||||
NEWSBLUR.log(['Real-time user update', username, feed_id]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}
|
||||
} else if (_.string.contains(feed_id, 'social:')) {
|
||||
if (feed_id != this.active_feed) {
|
||||
NEWSBLUR.log(['Real-time user update', username, feed_id]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}
|
||||
}
|
||||
}, this));
|
||||
|
||||
this.flags.feed_refreshing_in_realtime = true;
|
||||
this.setup_feed_refresh();
|
||||
|
||||
// $('.NB-module-content-account-realtime-subtitle').html($.make('b', 'Updating in real-time'));
|
||||
$('.NB-module-content-account-realtime').attr('title', 'Updating sites in real-time...').removeClass('NB-error');
|
||||
}, this));
|
||||
|
||||
this.socket.removeAllListeners('feed:update');
|
||||
this.socket.on('feed:update', _.bind(function(feed_id, message) {
|
||||
NEWSBLUR.log(['Real-time feed update', feed_id, message]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}, this));
|
||||
|
||||
this.socket.removeAllListeners(NEWSBLUR.Globals.username);
|
||||
this.socket.on('user:update', _.bind(function(username, feed_id) {
|
||||
if (this.flags.social_view) return;
|
||||
if (_.string.contains(feed_id, 'feed:')) {
|
||||
feed_id = parseInt(feed_id.replace('feed:', ''), 10);
|
||||
var active_feed_ids = [];
|
||||
if (this.active_folder && this.active_folder.length) {
|
||||
active_feed_ids = this.active_folder.feed_ids_in_folder();
|
||||
}
|
||||
if (feed_id != this.active_feed &&
|
||||
!_.contains(active_feed_ids, feed_id)) {
|
||||
NEWSBLUR.log(['Real-time user update', username, feed_id]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}
|
||||
} else if (_.string.contains(feed_id, 'social:')) {
|
||||
if (feed_id != this.active_feed) {
|
||||
NEWSBLUR.log(['Real-time user update', username, feed_id]);
|
||||
this.feed_unread_count(feed_id);
|
||||
}
|
||||
}
|
||||
}, this));
|
||||
|
||||
this.socket.on('disconnect', _.bind(function() {
|
||||
NEWSBLUR.log(["Lost connection to real-time pubsub. Falling back to polling."]);
|
||||
this.flags.feed_refreshing_in_realtime = false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import re
|
||||
import select
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -12,11 +11,15 @@ IGNORE_HOSTS = [
|
|||
'push',
|
||||
]
|
||||
|
||||
def main(role="app", role2="dev"):
|
||||
def main(role="app", role2="dev", command=None, path=None):
|
||||
streams = list()
|
||||
path = "/srv/newsblur/logs/newsblur.log"
|
||||
if not path:
|
||||
path = "/srv/newsblur/logs/newsblur.log"
|
||||
if not command:
|
||||
command = "tail -f"
|
||||
hosts_path = os.path.expanduser(os.path.join('../secrets-newsblur/configs/hosts.yml'))
|
||||
hosts = yaml.load(open(hosts_path))
|
||||
|
||||
for r in [role, role2]:
|
||||
if isinstance(hosts[r], dict):
|
||||
hosts[r] = ["%s:%s" % (hosts[r][k][-1], k) for k in hosts[r].keys()]
|
||||
|
@ -29,9 +32,9 @@ def main(role="app", role2="dev"):
|
|||
address = hostname
|
||||
if 'ec2' in hostname:
|
||||
s = subprocess.Popen(["ssh", "-i", os.path.expanduser("~/.ec2/sclay.pem"),
|
||||
address, "tail -f " + path], stdout=subprocess.PIPE)
|
||||
address, "%s %s" % (command, path)], stdout=subprocess.PIPE)
|
||||
else:
|
||||
s = subprocess.Popen(["ssh", address, "tail -f " + path], stdout=subprocess.PIPE)
|
||||
s = subprocess.Popen(["ssh", address, "%s %s" % (command, path)], stdout=subprocess.PIPE)
|
||||
s.name = hostname
|
||||
streams.append(s)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue