Add timeout to avatar fetches and avoid blocking on profile syncs
This commit is contained in:
parent
c64aa86736
commit
55be00d689
2 changed files with 9 additions and 5 deletions
|
@ -3041,13 +3041,15 @@ export async function startApp(): Promise<void> {
|
||||||
drop(ViewOnceOpenSyncs.onSync(attributes));
|
drop(ViewOnceOpenSyncs.onSync(attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onFetchLatestSync(ev: FetchLatestEvent): Promise<void> {
|
function onFetchLatestSync(ev: FetchLatestEvent): void {
|
||||||
ev.confirm();
|
// Don't block on fetchLatestSync events
|
||||||
|
drop(doFetchLatestSync(ev));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doFetchLatestSync(ev: FetchLatestEvent): Promise<void> {
|
||||||
const { eventType } = ev;
|
const { eventType } = ev;
|
||||||
|
|
||||||
const FETCH_LATEST_ENUM = Proto.SyncMessage.FetchLatest.Type;
|
const FETCH_LATEST_ENUM = Proto.SyncMessage.FetchLatest.Type;
|
||||||
|
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case FETCH_LATEST_ENUM.LOCAL_PROFILE: {
|
case FETCH_LATEST_ENUM.LOCAL_PROFILE: {
|
||||||
log.info('onFetchLatestSync: fetching latest local profile');
|
log.info('onFetchLatestSync: fetching latest local profile');
|
||||||
|
@ -3058,7 +3060,7 @@ export async function startApp(): Promise<void> {
|
||||||
}
|
}
|
||||||
case FETCH_LATEST_ENUM.STORAGE_MANIFEST:
|
case FETCH_LATEST_ENUM.STORAGE_MANIFEST:
|
||||||
log.info('onFetchLatestSync: fetching latest manifest');
|
log.info('onFetchLatestSync: fetching latest manifest');
|
||||||
await StorageService.runStorageServiceSyncJob();
|
StorageService.runStorageServiceSyncJob();
|
||||||
break;
|
break;
|
||||||
case FETCH_LATEST_ENUM.SUBSCRIPTION_STATUS:
|
case FETCH_LATEST_ENUM.SUBSCRIPTION_STATUS:
|
||||||
log.info('onFetchLatestSync: fetching latest subscription status');
|
log.info('onFetchLatestSync: fetching latest subscription status');
|
||||||
|
@ -3068,6 +3070,8 @@ export async function startApp(): Promise<void> {
|
||||||
default:
|
default:
|
||||||
log.info(`onFetchLatestSync: Unknown type encountered ${eventType}`);
|
log.info(`onFetchLatestSync: Unknown type encountered ${eventType}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ev.confirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onKeysSync(ev: KeysEvent) {
|
async function onKeysSync(ev: KeysEvent) {
|
||||||
|
|
|
@ -1984,7 +1984,7 @@ export function initialize({
|
||||||
contentType: 'application/octet-stream',
|
contentType: 'application/octet-stream',
|
||||||
proxyUrl,
|
proxyUrl,
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
timeout: 0,
|
timeout: 90 * SECOND,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
redactUrl: (href: string) => {
|
redactUrl: (href: string) => {
|
||||||
const pattern = RegExp(escapeRegExp(path), 'g');
|
const pattern = RegExp(escapeRegExp(path), 'g');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue