mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 05:45:02 -02:30
removing intervals that attempt to open sockets
the intervals are not necessary and we can rely on the socket service doing the reconnection for us.
This commit is contained in:
@@ -76,7 +76,7 @@ var tower = angular.module('Tower', [
|
|||||||
'UserFormDefinition',
|
'UserFormDefinition',
|
||||||
'FormGenerator',
|
'FormGenerator',
|
||||||
'OrganizationListDefinition',
|
'OrganizationListDefinition',
|
||||||
'jobTemplates',
|
'jobTemplates',
|
||||||
'UserListDefinition',
|
'UserListDefinition',
|
||||||
'UserHelper',
|
'UserHelper',
|
||||||
'PromptDialog',
|
'PromptDialog',
|
||||||
@@ -508,7 +508,7 @@ var tower = angular.module('Tower', [
|
|||||||
LoadConfig, Store, ShowSocketHelp, LicenseViewer, AboutAnsibleHelp, ConfigureTower, CreateCustomInventory) {
|
LoadConfig, Store, ShowSocketHelp, LicenseViewer, AboutAnsibleHelp, ConfigureTower, CreateCustomInventory) {
|
||||||
|
|
||||||
|
|
||||||
var e, html, sock, checkCount = 0;
|
var e, html, sock;
|
||||||
|
|
||||||
function detectBrowser() {
|
function detectBrowser() {
|
||||||
var ua = window.navigator.userAgent,
|
var ua = window.navigator.userAgent,
|
||||||
@@ -611,25 +611,6 @@ var tower = angular.module('Tower', [
|
|||||||
$log.debug('socket status: ' + $rootScope.socketStatus);
|
$log.debug('socket status: ' + $rootScope.socketStatus);
|
||||||
});
|
});
|
||||||
},2000);
|
},2000);
|
||||||
|
|
||||||
// monitor socket status
|
|
||||||
checkCount = 0;
|
|
||||||
$rootScope.dashboardInterval = setInterval(function() {
|
|
||||||
if (sock.checkStatus() === 'error' || checkCount > 5) {
|
|
||||||
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
|
||||||
$log.debug('socket status: ' + sock.checkStatus());
|
|
||||||
$log.debug('attempting new socket connection');
|
|
||||||
sock = null;
|
|
||||||
openSocket();
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
else if (sock.checkStatus() === 'connecting') {
|
|
||||||
checkCount++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on("$routeChangeStart", function (event, next) {
|
$rootScope.$on("$routeChangeStart", function (event, next) {
|
||||||
@@ -645,10 +626,6 @@ var tower = angular.module('Tower', [
|
|||||||
if ($rootScope.jobStdOutInterval) {
|
if ($rootScope.jobStdOutInterval) {
|
||||||
window.clearInterval($rootScope.jobStdOutInterval);
|
window.clearInterval($rootScope.jobStdOutInterval);
|
||||||
}
|
}
|
||||||
if ($rootScope.checkSocketConnectionInterval) {
|
|
||||||
// use to monitor and restart socket connections
|
|
||||||
window.clearInterval($rootScope.checkSocketConnectionInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
// On each navigation request, check that the user is logged in
|
// On each navigation request, check that the user is logged in
|
||||||
if (!/^\/(login|logout)/.test($location.path())) {
|
if (!/^\/(login|logout)/.test($location.path())) {
|
||||||
@@ -665,9 +642,6 @@ var tower = angular.module('Tower', [
|
|||||||
// gets here on timeout
|
// gets here on timeout
|
||||||
if (next.templateUrl !== (urlPrefix + 'partials/login.html')) {
|
if (next.templateUrl !== (urlPrefix + 'partials/login.html')) {
|
||||||
$rootScope.sessionTimer.expireSession();
|
$rootScope.sessionTimer.expireSession();
|
||||||
if($rootScope.dashboardInterval){
|
|
||||||
window.clearInterval($rootScope.dashboardInterval);
|
|
||||||
}
|
|
||||||
if (sock) {
|
if (sock) {
|
||||||
sock.socket.socket.disconnect();
|
sock.socket.socket.disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
|||||||
refresh_count = 0,
|
refresh_count = 0,
|
||||||
lastEventId = 0,
|
lastEventId = 0,
|
||||||
verbosity_options,
|
verbosity_options,
|
||||||
job_type_options,
|
job_type_options;
|
||||||
checkCount = 0;
|
|
||||||
|
|
||||||
scope.plays = [];
|
scope.plays = [];
|
||||||
scope.hosts = [];
|
scope.hosts = [];
|
||||||
@@ -107,22 +106,6 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
|||||||
}
|
}
|
||||||
openSocket();
|
openSocket();
|
||||||
|
|
||||||
$rootScope.checkSocketConnectionInterval = setInterval(function() {
|
|
||||||
if (event_socket.checkStatus() === 'error' || checkCount > 2) {
|
|
||||||
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
|
||||||
$log.debug('job detail page: initializing and restarting socket connections');
|
|
||||||
event_socket = null;
|
|
||||||
openSocket();
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
else if (event_socket.checkStatus() === 'connecting') {
|
|
||||||
checkCount++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
if ($rootScope.removeJobStatusChange) {
|
if ($rootScope.removeJobStatusChange) {
|
||||||
$rootScope.removeJobStatusChange();
|
$rootScope.removeJobStatusChange();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ export function JobStdoutController ($log, $rootScope, $scope, $compile, $routeP
|
|||||||
page_size = 500,
|
page_size = 500,
|
||||||
lastScrollTop = 0,
|
lastScrollTop = 0,
|
||||||
st,
|
st,
|
||||||
direction,
|
direction;
|
||||||
checkCount = 0;
|
|
||||||
|
|
||||||
|
|
||||||
function openSockets() {
|
function openSockets() {
|
||||||
@@ -72,23 +71,6 @@ export function JobStdoutController ($log, $rootScope, $scope, $compile, $routeP
|
|||||||
}
|
}
|
||||||
openSockets();
|
openSockets();
|
||||||
|
|
||||||
$rootScope.checkSocketConnectionInterval = setInterval(function() {
|
|
||||||
if (status_socket.checkStatus() === 'error' || checkCount > 2) {
|
|
||||||
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
|
||||||
$log.debug('stdout page: initializing and restarting socket connections');
|
|
||||||
status_socket = null;
|
|
||||||
event_socket = null;
|
|
||||||
openSockets();
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
else if (status_socket.checkStatus() === 'connecting') {
|
|
||||||
checkCount++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
$rootScope.jobStdOutInterval = setInterval( function() {
|
$rootScope.jobStdOutInterval = setInterval( function() {
|
||||||
if (event_queue > 0) {
|
if (event_queue > 0) {
|
||||||
// events happened since the last check
|
// events happened since the last check
|
||||||
@@ -272,4 +254,3 @@ export function JobStdoutController ($log, $rootScope, $scope, $compile, $routeP
|
|||||||
|
|
||||||
JobStdoutController.$inject = [ '$log', '$rootScope', '$scope', '$compile', '$routeParams', 'ClearScope', 'GetBasePath', 'Wait', 'Rest', 'ProcessErrors',
|
JobStdoutController.$inject = [ '$log', '$rootScope', '$scope', '$compile', '$routeParams', 'ClearScope', 'GetBasePath', 'Wait', 'Rest', 'ProcessErrors',
|
||||||
'Socket' ];
|
'Socket' ];
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
|
|||||||
api_complete = false,
|
api_complete = false,
|
||||||
schedule_socket,
|
schedule_socket,
|
||||||
job_socket,
|
job_socket,
|
||||||
max_rows, checkCount=0;
|
max_rows;
|
||||||
|
|
||||||
function openSockets() {
|
function openSockets() {
|
||||||
job_socket = Socket({
|
job_socket = Socket({
|
||||||
@@ -50,23 +50,6 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.checkSocketConnectionInterval = setInterval(function() {
|
|
||||||
if (job_socket.checkStatus() === 'error' || checkCount > 2) {
|
|
||||||
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
|
||||||
$log.debug('jobs page: initializing and restarting socket connections');
|
|
||||||
job_socket = null;
|
|
||||||
schedule_socket = null;
|
|
||||||
openSockets();
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
else if (job_socket.checkStatus() === 'connecting') {
|
|
||||||
checkCount++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkCount = 0;
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
function processEvent(event) {
|
function processEvent(event) {
|
||||||
switch(event.status) {
|
switch(event.status) {
|
||||||
case 'running':
|
case 'running':
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
},
|
},
|
||||||
'connect timeout': 3000,
|
'connect timeout': 3000,
|
||||||
'try multiple transports': false,
|
'try multiple transports': false,
|
||||||
'max reconnection attempts': 3,
|
'max reconnection attempts': 10,
|
||||||
'reconnection limit': 10000,
|
'reconnection limit': 2000,
|
||||||
'force new connection': true
|
'force new connection': true
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,9 +107,6 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
|
|
||||||
if (token_actual === token) {
|
if (token_actual === token) {
|
||||||
self.socket.socket.disconnect();
|
self.socket.socket.disconnect();
|
||||||
if($rootScope.dashboardInterval){
|
|
||||||
window.clearInterval($rootScope.dashboardInterval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.scope.$apply(function () {
|
self.scope.$apply(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user