forked from mystiq/hydrogen-web
ConnectionError isn't throw from start, but sets sync.error
This commit is contained in:
parent
4b19e3c498
commit
b852feeb9c
1 changed files with 11 additions and 12 deletions
|
@ -234,19 +234,18 @@ export class SessionContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _waitForFirstSync() {
|
async _waitForFirstSync() {
|
||||||
try {
|
|
||||||
this._sync.start();
|
this._sync.start();
|
||||||
this._status.set(LoadStatus.FirstSync);
|
this._status.set(LoadStatus.FirstSync);
|
||||||
} catch (err) {
|
// only transition into Ready once the first sync has succeeded
|
||||||
// swallow ConnectionError here and continue,
|
this._waitForFirstSyncHandle = this._sync.status.waitFor(s => {
|
||||||
|
if (s === SyncStatus.Stopped) {
|
||||||
|
// keep waiting if there is a ConnectionError
|
||||||
// as the reconnector above will call
|
// as the reconnector above will call
|
||||||
// sync.start again to retry in this case
|
// sync.start again to retry in this case
|
||||||
if (!(err instanceof ConnectionError)) {
|
return this._sync.error.name !== "ConnectionError";
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
}
|
return s === SyncStatus.Syncing;
|
||||||
// only transition into Ready once the first sync has succeeded
|
});
|
||||||
this._waitForFirstSyncHandle = this._sync.status.waitFor(s => s === SyncStatus.Syncing || s === SyncStatus.Stopped);
|
|
||||||
try {
|
try {
|
||||||
await this._waitForFirstSyncHandle.promise;
|
await this._waitForFirstSyncHandle.promise;
|
||||||
if (this._sync.status.get() === SyncStatus.Stopped) {
|
if (this._sync.status.get() === SyncStatus.Stopped) {
|
||||||
|
|
Loading…
Reference in a new issue