From 11449b77a9f540c758c13d5d13f4fdec2b2d1805 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 22 Nov 2017 11:46:24 -0500 Subject: [PATCH] add debugging. increase concurrency of request queue --- web/skins/classic/views/js/montage.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index d77959b64..a9aef7b5b 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -1,4 +1,4 @@ -var requestQueue = new Request.Queue( { concurrent: 2, stopOnFailure: false } ); +var requestQueue = new Request.Queue( { concurrent: monitorData.length, stopOnFailure: false } ); function Monitor( monitorData ) { this.id = monitorData.id; @@ -7,15 +7,18 @@ function Monitor( monitorData ) { this.status = null; this.alarmState = STATE_IDLE; this.lastAlarmState = STATE_IDLE; - this.streamCmdParms = 'view=request&request=stream&connkey='+this.connKey; + this.streamCmdParms = this.server_url+'?view=request&request=stream&connkey='+this.connKey; this.onclick = monitorData.onclick; if ( auth_hash ) this.streamCmdParms += '&auth='+auth_hash; this.streamCmdTimer = null; - this.start = function( delay ) { + /* + this.zm_startup = function( delay ) { + console.log("Starting streamwatch for " + this.connKey ); this.streamCmdTimer = this.streamCmdQuery.delay( delay, this ); }; + */ this.setStateClass = function( element, stateClass ) { if ( !element.hasClass( stateClass ) ) { @@ -38,7 +41,10 @@ function Monitor( monitorData ) { this.onFailure = function( xhr ) { console.log('onFailure: ' + this.connKey); console.log(xhr ); - requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq ); + if ( ! requestQueue.hasNext("cmdReq"+this.id) ) { + console.log("Not requeuing because there is one already"); + requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq ); + } if ( 0 ) { // Requeue, but want to wait a while. if ( this.streamCmdTimer ) @@ -47,6 +53,7 @@ function Monitor( monitorData ) { this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this, true ); requestQueue.resume(); } + console.log("done failure"); }; this.getStreamCmdResponse = function( respObj, respText ) { @@ -134,6 +141,7 @@ function Monitor( monitorData ) { console.log( this.connKey+": Resending" ); this.streamCmdReq.cancel(); } + console.log("Starting CmdQuery for " + this.connKey ); this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY ); }; @@ -148,6 +156,7 @@ function Monitor( monitorData ) { link: 'cancel' } ); + console.log("queueing for " + this.id + " " + this.connKey ); requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq ); } @@ -375,7 +384,7 @@ function cancel_layout(button) { var monitors = new Array(); function initPage() { - +console.log("initPage"); for ( var i = 0; i < monitorData.length; i++ ) { monitors[i] = new Monitor(monitorData[i]); } @@ -384,7 +393,8 @@ function initPage() { for ( var i = 0; i < monitorData.length; i++ ) { var delay = Math.round( (Math.random()+0.75)*statusRefreshTimeout ); console.log("Delay for monitor " + monitorData[i].id + " is " + delay ); - monitors[i].start(delay); + monitors[i].streamCmdQuery.delay( delay, monitors[i] ); + //monitors[i].zm_startup(delay); } } // Kick everything off