disable fail gerbil for nag instead

This commit is contained in:
Sean Yesmunt 2020-03-26 16:17:41 -04:00
parent cc5751617c
commit 3ca3176d28
2 changed files with 6 additions and 6 deletions

View file

@ -5,6 +5,7 @@ import fetchWithTimeout from 'util/fetch';
const STATUS_TIMEOUT_LIMIT = 10000;
export const STATUS_OK = 'ok';
export const STATUS_DEGRADED = 'degraded';
export const STATUS_FAILING = 'failing';
export const STATUS_DOWN = 'down';
export function useDegradedPerformance(onDegradedPerformanceCallback) {
@ -12,14 +13,12 @@ export function useDegradedPerformance(onDegradedPerformanceCallback) {
fetchWithTimeout(STATUS_TIMEOUT_LIMIT, fetch(`${LBRY_TV_API}/internal/status`))
.then(response => response.json())
.then(status => {
if (status.general_state === STATUS_DEGRADED) {
onDegradedPerformanceCallback(STATUS_DEGRADED);
} else {
onDegradedPerformanceCallback(STATUS_OK);
if (status.general_state !== STATUS_OK) {
onDegradedPerformanceCallback(STATUS_FAILING);
}
})
.catch(() => {
onDegradedPerformanceCallback(STATUS_DOWN);
onDegradedPerformanceCallback(STATUS_FAILING);
});
}, []);
}

View file

@ -26,6 +26,7 @@ import {
useDegradedPerformance,
STATUS_OK,
STATUS_DEGRADED,
STATUS_FAILING,
STATUS_DOWN,
} from 'lbrytv/effects/use-degraded-performance';
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
@ -301,7 +302,7 @@ function App(props: Props) {
{/* @if TARGET='web' */}
<YoutubeWelcome />
<OpenInAppLink uri={uri} />
{lbryTvApiStatus === STATUS_DEGRADED && (
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && (
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
)}
{lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (