Commit 7d200b6c authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '45406-error-getting-performance-bar-results-for-uuid-regularly-seen-in-production' into 'master'

Resolve ""Error getting performance bar results for [UUID]" regularly seen in production"

Closes #45406

See merge request gitlab-org/gitlab-ce!18419
parents 478200ae d77db0ad
...@@ -10,29 +10,25 @@ export default class PerformanceBarService { ...@@ -10,29 +10,25 @@ export default class PerformanceBarService {
} }
static registerInterceptor(peekUrl, callback) { static registerInterceptor(peekUrl, callback) {
vueResourceInterceptor = (request, next) => { const interceptor = response => {
next(response => {
const requestId = response.headers['x-request-id']; const requestId = response.headers['x-request-id'];
const requestUrl = response.url; // Get the request URL from response.config for Axios, and response for
// Vue Resource.
const requestUrl = (response.config || response).url;
const cachedResponse = response.headers['x-gitlab-from-cache'] === 'true';
if (requestUrl !== peekUrl && requestId) { if (requestUrl !== peekUrl && requestId && !cachedResponse) {
callback(requestId, requestUrl); callback(requestId, requestUrl);
} }
});
};
Vue.http.interceptors.push(vueResourceInterceptor); return response;
};
return axios.interceptors.response.use(response => { vueResourceInterceptor = (request, next) => next(interceptor);
const requestId = response.headers['x-request-id'];
const requestUrl = response.config.url;
if (requestUrl !== peekUrl && requestId) { Vue.http.interceptors.push(vueResourceInterceptor);
callback(requestId, requestUrl);
}
return response; return axios.interceptors.response.use(interceptor);
});
} }
static removeInterceptor(interceptor) { static removeInterceptor(interceptor) {
......
...@@ -50,7 +50,7 @@ module Gitlab ...@@ -50,7 +50,7 @@ module Gitlab
status_code = Gitlab::PollingInterval.polling_enabled? ? 304 : 429 status_code = Gitlab::PollingInterval.polling_enabled? ? 304 : 429
[status_code, { 'ETag' => etag }, []] [status_code, { 'ETag' => etag, 'X-Gitlab-From-Cache' => 'true' }, []]
end end
def track_cache_miss(if_none_match, cached_value_present, route) def track_cache_miss(if_none_match, cached_value_present, route)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment