mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
no need to catch here, can't handle the error
This commit is contained in:
parent
3e763ab5c0
commit
c115164822
19
src/sync.js
19
src/sync.js
@ -28,22 +28,11 @@ export class Sync {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._isSyncing = true;
|
this._isSyncing = true;
|
||||||
try {
|
|
||||||
let syncToken = session.syncToken;
|
let syncToken = session.syncToken;
|
||||||
// do initial sync if needed
|
// do initial sync if needed
|
||||||
if (!syncToken) {
|
if (!syncToken) {
|
||||||
syncToken = await this._syncRequest();
|
syncToken = await this._syncRequest();
|
||||||
}
|
}
|
||||||
} catch(err) {
|
|
||||||
//expected when stop is called
|
|
||||||
if (err instanceof RequestAbortError) {
|
|
||||||
|
|
||||||
} else if (err instanceof HomeServerError) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// something threw something
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._syncLoop(syncToken);
|
this._syncLoop(syncToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,13 +52,13 @@ export class Sync {
|
|||||||
const response = await this._currentRequest.response;
|
const response = await this._currentRequest.response;
|
||||||
syncToken = response.next_batch;
|
syncToken = response.next_batch;
|
||||||
const storeNames = this._storage.storeNames;
|
const storeNames = this._storage.storeNames;
|
||||||
const txn = this._storage.startReadWriteTxn([
|
const syncTxn = this._storage.startReadWriteTxn([
|
||||||
storeNames.timeline,
|
storeNames.timeline,
|
||||||
storeNames.sync,
|
storeNames.session,
|
||||||
storeNames.state
|
storeNames.state
|
||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
session.applySync(syncToken, response.account_data, txn);
|
session.applySync(syncToken, response.account_data, syncTxn);
|
||||||
// to_device
|
// to_device
|
||||||
// presence
|
// presence
|
||||||
parseRooms(response.rooms, async (roomId, roomResponse, membership) => {
|
parseRooms(response.rooms, async (roomId, roomResponse, membership) => {
|
||||||
@ -77,7 +66,7 @@ export class Sync {
|
|||||||
if (!room) {
|
if (!room) {
|
||||||
room = session.createRoom(roomId);
|
room = session.createRoom(roomId);
|
||||||
}
|
}
|
||||||
room.applySync(roomResponse, membership, txn);
|
room.applySync(roomResponse, membership, syncTxn);
|
||||||
});
|
});
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// avoid corrupting state by only
|
// avoid corrupting state by only
|
||||||
|
Loading…
Reference in New Issue
Block a user