Restore SDK error logging, limiting to support_create.

v1 publishing timeout is already being recorded. Look for the string `publish-v1: timed out after`
This commit is contained in:
infinite-persistence 2022-05-12 10:37:45 +08:00 committed by Thomas Zarebczan
parent c4f88ac7e8
commit b2b1692525

View file

@ -1,5 +1,5 @@
// @flow // @flow
// import analytics from 'analytics'; import analytics from 'analytics';
import { FETCH_TIMEOUT } from 'constants/errors'; import { FETCH_TIMEOUT } from 'constants/errors';
import { NO_AUTH, X_LBRY_AUTH_TOKEN } from 'constants/token'; import { NO_AUTH, X_LBRY_AUTH_TOKEN } from 'constants/token';
import fetchWithTimeout from 'util/fetch'; import fetchWithTimeout from 'util/fetch';
@ -7,6 +7,7 @@ import fetchWithTimeout from 'util/fetch';
require('proxy-polyfill'); require('proxy-polyfill');
const CHECK_DAEMON_STARTED_TRY_NUMBER = 200; const CHECK_DAEMON_STARTED_TRY_NUMBER = 200;
const ERR_LOG_METHOD_WHITELIST = ['support_create'];
// Basic LBRY sdk connection config // Basic LBRY sdk connection config
// Offers a proxy to call LBRY sdk methods // Offers a proxy to call LBRY sdk methods
@ -306,7 +307,7 @@ export function apiCall(method: string, params: ?{}, resolve: Function, reject:
? Lbry.alternateConnectionString ? Lbry.alternateConnectionString
: Lbry.daemonConnectionString; : Lbry.daemonConnectionString;
const SDK_FETCH_TIMEOUT_MS = 1800000; const SDK_FETCH_TIMEOUT_MS = 60000;
return fetchWithTimeout(SDK_FETCH_TIMEOUT_MS, fetch(connectionString + '?m=' + method, options)) return fetchWithTimeout(SDK_FETCH_TIMEOUT_MS, fetch(connectionString + '?m=' + method, options))
.then((response) => checkAndParse(response, method)) .then((response) => checkAndParse(response, method))
.then((response) => { .then((response) => {
@ -322,7 +323,9 @@ export function apiCall(method: string, params: ?{}, resolve: Function, reject:
.catch((err) => { .catch((err) => {
ApiFailureMgr.logFailure(method, params, counter); ApiFailureMgr.logFailure(method, params, counter);
if (err?.message === FETCH_TIMEOUT) { if (err?.message === FETCH_TIMEOUT) {
// analytics.error(`${method}: timed out after ${SDK_FETCH_TIMEOUT_MS / 1000}s`); if (ERR_LOG_METHOD_WHITELIST.includes(method)) {
analytics.error(`${method}: timed out after ${SDK_FETCH_TIMEOUT_MS / 1000}s`);
}
reject(resolveFetchErrorMsg(method, FETCH_TIMEOUT)); reject(resolveFetchErrorMsg(method, FETCH_TIMEOUT));
} else { } else {
reject(err); reject(err);