Notify: log retry attempts

This commit is contained in:
infinite-persistence 2021-11-12 16:30:33 +08:00
parent 62e7fe06a5
commit d8080a9fda
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -1,5 +1,6 @@
// @flow // @flow
import * as tus from 'tus-js-client'; import * as tus from 'tus-js-client';
import analytics from '../../ui/analytics';
import { X_LBRY_AUTH_TOKEN } from '../../ui/constants/token'; import { X_LBRY_AUTH_TOKEN } from '../../ui/constants/token';
import { doUpdateUploadAdd, doUpdateUploadProgress, doUpdateUploadRemove } from '../../ui/redux/actions/publish'; import { doUpdateUploadAdd, doUpdateUploadProgress, doUpdateUploadRemove } from '../../ui/redux/actions/publish';
import { LBRY_WEB_PUBLISH_API_V2 } from 'config'; import { LBRY_WEB_PUBLISH_API_V2 } from 'config';
@ -88,6 +89,7 @@ export function makeResumableUploadRequest(
xhr.onerror = () => { xhr.onerror = () => {
if (retries > 0 && xhr.status === 0) { if (retries > 0 && xhr.status === 0) {
--retries; --retries;
analytics.error('notify: first attempt failed (status=0). Retrying after 10s...');
setTimeout(() => makeNotifyRequest(), 10000); // Auto-retry after 10s delay. setTimeout(() => makeNotifyRequest(), 10000); // Auto-retry after 10s delay.
} else { } else {
window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' })); window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' }));