Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Aug 17, 2021
1 parent 39c571d commit ee12bb1
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/firestore/src/core/component_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,11 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro

// NOTE: This will immediately call the listener, so we make sure to
// set it after localStore / remoteStore are started.
await this.persistence.setPrimaryStateListener(async isPrimary => {
await syncEngineApplyPrimaryState(
this.onlineComponentProvider.syncEngine,
isPrimary
);
if (this.gcScheduler) {
if (isPrimary && !this.gcScheduler.started) {
await this.persistence.setPrimaryStateListener(() => {
if (this.gcScheduler && !this.gcScheduler.started) {
this.gcScheduler.start(this.localStore);
} else if (!isPrimary) {
this.gcScheduler.stop();
}
}
return Promise.resolve();
});
}

Expand Down Expand Up @@ -283,6 +276,22 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
};
await this.sharedClientState.start();
}

// NOTE: This will immediately call the listener, so we make sure to
// set it after localStore / remoteStore are started.
await this.persistence.setPrimaryStateListener(async isPrimary => {
await syncEngineApplyPrimaryState(
this.onlineComponentProvider.syncEngine,
isPrimary
);
if (this.gcScheduler) {
if (isPrimary && !this.gcScheduler.started) {
this.gcScheduler.start(this.localStore);
} else if (!isPrimary) {
this.gcScheduler.stop();
}
}
});
}

createSharedClientState(cfg: ComponentConfiguration): SharedClientState {
Expand Down

0 comments on commit ee12bb1

Please sign in to comment.