mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
Merge pull request #2697 from ryanpetrello/smarter-websocket-expiry
stop various async background requests from bumping the session expiry Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -126,8 +126,9 @@ class SessionTimeoutMiddleware(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def process_response(self, request, response):
|
def process_response(self, request, response):
|
||||||
|
should_skip = 'HTTP_X_WS_SESSION_QUIET' in request.META
|
||||||
req_session = getattr(request, 'session', None)
|
req_session = getattr(request, 'session', None)
|
||||||
if req_session and not req_session.is_empty():
|
if req_session and not req_session.is_empty() and should_skip is False:
|
||||||
expiry = int(settings.SESSION_COOKIE_AGE)
|
expiry = int(settings.SESSION_COOKIE_AGE)
|
||||||
request.session.set_expiry(expiry)
|
request.session.set_expiry(expiry)
|
||||||
response['Session-Timeout'] = expiry
|
response['Session-Timeout'] = expiry
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ function ListJobsController (
|
|||||||
};
|
};
|
||||||
|
|
||||||
function refreshJobs () {
|
function refreshJobs () {
|
||||||
qs.search(SearchBasePath, $state.params.job_search)
|
qs.search(SearchBasePath, $state.params.job_search, { 'X-WS-Session-Quiet': true })
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
vm.jobs = data.results;
|
vm.jobs = data.results;
|
||||||
vm.job_dataset = data;
|
vm.job_dataset = data;
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ function ListTemplatesController(
|
|||||||
function refreshTemplates() {
|
function refreshTemplates() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
let path = GetBasePath('unified_job_templates');
|
let path = GetBasePath('unified_job_templates');
|
||||||
qs.search(path, $state.params.template_search)
|
qs.search(path, $state.params.template_search, { 'X-WS-Session-Quiet': true })
|
||||||
.then(function(searchResponse) {
|
.then(function(searchResponse) {
|
||||||
vm.dataset = searchResponse.data;
|
vm.dataset = searchResponse.data;
|
||||||
vm.templates = vm.dataset.results;
|
vm.templates = vm.dataset.results;
|
||||||
|
|||||||
@@ -62,10 +62,11 @@ function requestWithCache (config) {
|
|||||||
* @yields {boolean} - Indicating a match has been found. If so, the results
|
* @yields {boolean} - Indicating a match has been found. If so, the results
|
||||||
* are set on the model.
|
* are set on the model.
|
||||||
*/
|
*/
|
||||||
function search (params = {}, config = {}) {
|
function search (params = {}, config = {}, headers = {}) {
|
||||||
const req = {
|
const req = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: this.path
|
url: this.path,
|
||||||
|
headers
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof params === 'string') {
|
if (typeof params === 'string') {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
url = dash_path + 'graphs/jobs/?period='+period+'&job_type='+jobType;
|
url = dash_path + 'graphs/jobs/?period='+period+'&job_type='+jobType;
|
||||||
|
Rest.setHeader({'X-WS-Session-Quiet': true});
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
var result = Rest.get()
|
var result = Rest.get()
|
||||||
.catch(function(response) {
|
.catch(function(response) {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export default ['$scope', '$rootScope','Wait',
|
|||||||
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status });
|
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status });
|
||||||
});
|
});
|
||||||
Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job");
|
Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job");
|
||||||
|
Rest.setHeader({'X-WS-Session-Quiet': true});
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
data = data.results;
|
data = data.results;
|
||||||
@@ -119,6 +120,7 @@ export default ['$scope', '$rootScope','Wait',
|
|||||||
});
|
});
|
||||||
|
|
||||||
Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job");
|
Rest.setUrl(GetBasePath("unified_jobs") + "?order_by=-finished&page_size=5&finished__isnull=false&type=workflow_job,job");
|
||||||
|
Rest.setHeader({'X-WS-Session-Quiet': true});
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
$scope.dashboardJobsListData = data.results;
|
$scope.dashboardJobsListData = data.results;
|
||||||
|
|||||||
Reference in New Issue
Block a user