Log SDK timeout errors
Logging it so we know when to give the SDKs a kick
This commit is contained in:
parent
511097cd67
commit
d7d8d3516e
2 changed files with 5 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
// @flow
|
||||
import analytics from 'analytics';
|
||||
import { FETCH_TIMEOUT } from 'constants/errors';
|
||||
import { NO_AUTH, X_LBRY_AUTH_TOKEN } from 'constants/token';
|
||||
import fetchWithTimeout from 'util/fetch';
|
||||
|
@ -320,7 +321,8 @@ export function apiCall(method: string, params: ?{}, resolve: Function, reject:
|
|||
})
|
||||
.catch((err) => {
|
||||
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`);
|
||||
reject(resolveFetchErrorMsg(method, FETCH_TIMEOUT));
|
||||
} else {
|
||||
reject(err);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// - 'file' binary
|
||||
// - 'json_payload' publish params to be passed to the server's sdk.
|
||||
|
||||
import analytics from '../../ui/analytics';
|
||||
import { PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL } from '../../ui/constants/errors';
|
||||
import { X_LBRY_AUTH_TOKEN } from '../../ui/constants/token';
|
||||
import { doUpdateUploadAdd, doUpdateUploadProgress, doUpdateUploadRemove } from '../../ui/redux/actions/publish';
|
||||
|
@ -64,6 +65,7 @@ export function makeUploadRequest(
|
|||
reject(new Error(__('There was a problem with your upload. Please try again.')));
|
||||
};
|
||||
xhr.ontimeout = () => {
|
||||
analytics.error(`publish-v1: timed out after ${PUBLISH_FETCH_TIMEOUT_MS / 1000}s`);
|
||||
window.store.dispatch(doUpdateUploadProgress({ guid, status: 'error' }));
|
||||
reject(new Error(PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL));
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue