Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions modules/ui/src/app/interceptors/error.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import {
} from 'rxjs';
import { NotificationService } from '../services/notification.service';

import { SYSTEM_STOP } from '../services/test-run.service';
import { SYSTEM_STOP, EXPORT } from '../services/test-run.service';
import { finalize } from 'rxjs/operators';

const DEFAULT_TIMEOUT_MS = 5000;
const SYSTEM_STOP_TIMEOUT_MS = 60 * 1000;
const EXPORT_ZIP_TIMEOUT_MS = 60 * 1000;

@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
Expand All @@ -45,10 +46,13 @@ export class ErrorInterceptor implements HttpInterceptor {
next: HttpHandler,
timeoutMs = DEFAULT_TIMEOUT_MS
): Observable<HttpEvent<unknown>> {
const timeoutValue =
request.url.includes(SYSTEM_STOP) || this.isTestrunStop
? SYSTEM_STOP_TIMEOUT_MS
: timeoutMs;
let timeoutValue = timeoutMs;
if (request.url.includes(SYSTEM_STOP) || this.isTestrunStop) {
timeoutValue = SYSTEM_STOP_TIMEOUT_MS;
}
if (request.url.includes(EXPORT)) {
timeoutValue = EXPORT_ZIP_TIMEOUT_MS;
}
if (request.url.includes(SYSTEM_STOP)) {
this.isTestrunStop = true;
}
Expand Down
1 change: 1 addition & 0 deletions modules/ui/src/app/services/test-run.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {

const API_URL = `http://${window.location.hostname}:8000`;
export const SYSTEM_STOP = '/system/stop';
export const EXPORT = '/export';

export const UNAVAILABLE_VERSION = {
installed_version: 'v?.?',
Expand Down
Loading