mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03: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:
parent
39d0f91fdb
commit
0fdb9703ea
@ -76,7 +76,7 @@ var tower = angular.module('Tower', [
|
||||
'UserFormDefinition',
|
||||
'FormGenerator',
|
||||
'OrganizationListDefinition',
|
||||
'jobTemplates',
|
||||
'jobTemplates',
|
||||
'UserListDefinition',
|
||||
'UserHelper',
|
||||
'PromptDialog',
|
||||
@ -508,7 +508,7 @@ var tower = angular.module('Tower', [
|
||||
LoadConfig, Store, ShowSocketHelp, LicenseViewer, AboutAnsibleHelp, ConfigureTower, CreateCustomInventory) {
|
||||
|
||||
|
||||
var e, html, sock, checkCount = 0;
|
||||
var e, html, sock;
|
||||
|
||||
function detectBrowser() {
|
||||
var ua = window.navigator.userAgent,
|
||||
@ -611,25 +611,6 @@ var tower = angular.module('Tower', [
|
||||
$log.debug('socket status: ' + $rootScope.socketStatus);
|
||||
});
|
||||
},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) {
|
||||
@ -645,10 +626,6 @@ var tower = angular.module('Tower', [
|
||||
if ($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
|
||||
if (!/^\/(login|logout)/.test($location.path())) {
|
||||
@ -665,9 +642,6 @@ var tower = angular.module('Tower', [
|
||||
// gets here on timeout
|
||||
if (next.templateUrl !== (urlPrefix + 'partials/login.html')) {
|
||||
$rootScope.sessionTimer.expireSession();
|
||||
if($rootScope.dashboardInterval){
|
||||
window.clearInterval($rootScope.dashboardInterval);
|
||||
}
|
||||
if (sock) {
|
||||
sock.socket.socket.disconnect();
|
||||
}
|
||||
|
||||
@ -24,8 +24,7 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
||||
refresh_count = 0,
|
||||
lastEventId = 0,
|
||||
verbosity_options,
|
||||
job_type_options,
|
||||
checkCount = 0;
|
||||
job_type_options;
|
||||
|
||||
scope.plays = [];
|
||||
scope.hosts = [];
|
||||
@ -107,22 +106,6 @@ export function JobDetailController ($location, $rootScope, $scope, $compile, $r
|
||||
}
|
||||
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) {
|
||||
$rootScope.removeJobStatusChange();
|
||||
}
|
||||
|
||||
@ -29,8 +29,7 @@ export function JobStdoutController ($log, $rootScope, $scope, $compile, $routeP
|
||||
page_size = 500,
|
||||
lastScrollTop = 0,
|
||||
st,
|
||||
direction,
|
||||
checkCount = 0;
|
||||
direction;
|
||||
|
||||
|
||||
function openSockets() {
|
||||
@ -72,23 +71,6 @@ export function JobStdoutController ($log, $rootScope, $scope, $compile, $routeP
|
||||
}
|
||||
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() {
|
||||
if (event_queue > 0) {
|
||||
// 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',
|
||||
'Socket' ];
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
|
||||
api_complete = false,
|
||||
schedule_socket,
|
||||
job_socket,
|
||||
max_rows, checkCount=0;
|
||||
max_rows;
|
||||
|
||||
function openSockets() {
|
||||
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) {
|
||||
switch(event.status) {
|
||||
case 'running':
|
||||
|
||||
@ -80,8 +80,8 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
||||
},
|
||||
'connect timeout': 3000,
|
||||
'try multiple transports': false,
|
||||
'max reconnection attempts': 3,
|
||||
'reconnection limit': 10000,
|
||||
'max reconnection attempts': 10,
|
||||
'reconnection limit': 2000,
|
||||
'force new connection': true
|
||||
});
|
||||
|
||||
@ -107,9 +107,6 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
||||
|
||||
if (token_actual === token) {
|
||||
self.socket.socket.disconnect();
|
||||
if($rootScope.dashboardInterval){
|
||||
window.clearInterval($rootScope.dashboardInterval);
|
||||
}
|
||||
}
|
||||
|
||||
self.scope.$apply(function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user