From 13a6d7f7c6d0007466f20e802522152be58bc6ba Mon Sep 17 00:00:00 2001 From: Palash Gupta Date: Tue, 27 Dec 2022 13:36:37 +0530 Subject: [PATCH] fix: live tail time out is updated (#1899) * fix: live tail time out is updated * Update livetail.ts Co-authored-by: Pranay Prateek Co-authored-by: Ankit Nayan --- frontend/src/api/logs/livetail.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/api/logs/livetail.ts b/frontend/src/api/logs/livetail.ts index f1cec5472a..150f63d193 100644 --- a/frontend/src/api/logs/livetail.ts +++ b/frontend/src/api/logs/livetail.ts @@ -4,14 +4,16 @@ import { ENVIRONMENT } from 'constants/env'; import { LOCALSTORAGE } from 'constants/localStorage'; import { EventSourcePolyfill } from 'event-source-polyfill'; -export const LiveTail = (queryParams: string): EventSourcePolyfill => { - const dict = { - headers: { - Authorization: `Bearer ${getLocalStorageKey(LOCALSTORAGE.AUTH_TOKEN)}`, - }, - }; - return new EventSourcePolyfill( +// 10 min in ms +const TIMEOUT_IN_MS = 10 * 60 * 1000; + +export const LiveTail = (queryParams: string): EventSourcePolyfill => + new EventSourcePolyfill( `${ENVIRONMENT.baseURL}${apiV1}logs/tail?${queryParams}`, - dict, + { + headers: { + Authorization: `Bearer ${getLocalStorageKey(LOCALSTORAGE.AUTH_TOKEN)}`, + }, + heartbeatTimeout: TIMEOUT_IN_MS, + }, ); -};