From bc59711fa33d535cfe6a80eb3d8487a69a5cb015 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Sun, 17 Mar 2013 14:41:29 -0700 Subject: [PATCH] Naively connecting to real-time socket.io. --- config/haproxy.conf | 2 +- fabfile.py | 4 ++-- media/js/newsblur/reader/reader.js | 32 ++---------------------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/config/haproxy.conf b/config/haproxy.conf index 576123b8e..f7911d9a5 100644 --- a/config/haproxy.conf +++ b/config/haproxy.conf @@ -6,7 +6,7 @@ global ca-base /srv/newsblur/config/certificates crt-base /srv/newsblur/config/certificates log 127.0.0.1 local0 notice - log 127.0.0.1 local1 info + # log 127.0.0.1 local1 info defaults log global diff --git a/fabfile.py b/fabfile.py index 5df6eccd5..ab79481f3 100644 --- a/fabfile.py +++ b/fabfile.py @@ -181,8 +181,8 @@ def post_deploy(): cleanup_assets() @parallel -def deploy(): - deploy_code(copy_assets=True) +def deploy(fast=False): + deploy_code(copy_assets=True, fast=fast) def deploy_full(): deploy_code(copy_assets=True, full=True) diff --git a/media/js/newsblur/reader/reader.js b/media/js/newsblur/reader/reader.js index ac11b7953..a019d5401 100644 --- a/media/js/newsblur/reader/reader.js +++ b/media/js/newsblur/reader/reader.js @@ -3877,18 +3877,12 @@ var server = window.location.protocol + '//' + window.location.hostname; var port = _.string.startsWith(window.location.protocol, 'https') ? 8889 : 8888; this.socket = this.socket || io.connect(server, { - "reconnection delay": 5000, - "connect timeout": 5000, + "reconnection delay": 2000, + "connect timeout": 2000, "port": NEWSBLUR.Globals.debug ? port : 80 }); // this.socket.refresh_feeds = _.debounce(_.bind(this.force_feeds_refresh, this), 1000*10); - this.socket.on('reconnect_error', _.bind(function() { - this.retry_socketio_connect(); - }, this)); - this.socket.on('reconnect_failed', _.bind(function() { - this.retry_socketio_connect(); - }, this)); 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."]); @@ -3934,8 +3928,6 @@ this.setup_feed_refresh(); // $('.NB-module-content-account-realtime-subtitle').html($.make('b', 'Updating every 60 sec')); $('.NB-module-content-account-realtime').attr('title', 'Updating sites every ' + this.flags.refresh_interval + ' seconds...').addClass('NB-error'); - - this.retry_socketio_connect(); }, this)); this.socket.on('error', _.bind(function() { NEWSBLUR.log(["Can't connect to real-time pubsub."]); @@ -3943,31 +3935,11 @@ // $('.NB-module-content-account-realtime-subtitle').html($.make('b', 'Updating every 60 sec')); $('.NB-module-content-account-realtime').attr('title', 'Updating sites every ' + this.flags.refresh_interval + ' seconds...').addClass('NB-error'); _.delay(_.bind(this.setup_socket_realtime_unread_counts, this), 60*1000); - - this.retry_socketio_connect(); - }, this)); } }, - retry_socketio_connect: function() { - var port = _.string.startsWith(window.location.protocol, 'https') ? 8889 : 8888; - console.log('Real-time connection failed. Tried port:', this.socket.socket.options.port); - - if (this.socket.socket.options.port == port) { - this.socket.socket.options.port = 80; - } else { - this.socket.socket.options.port = port; - } - - this.counts.socket_reconnects += .5; - clearTimeout(this.cache.socketio_reconnect); - this.cache.socketio_reconnect = _.delay(_.bind(function() { - this.socket.socket.connect(); - }, this), this.counts.socket_reconnects * 1000); - }, - send_socket_active_feeds: function() { if (!this.socket) return;