Skip to content

Adding getActiveClients() #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 22, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

This will be used by SharedClientState to retrieve the list of active clients during its startup. Using this list, the SharedClientState can then read all relevant rows in LocalStorage.

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably LGTM, but I have a question...

await this.persistence.start();
await this.localStore.start();
await this.remoteStore.start();
async startIfNeeded(): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be idempotent now? I'm not exactly following what changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this was implemented before called start() for all clients before execution any of the steps in the tests. That meant by the time client(0).expectNumActiveClients(1) was called, we had already initialized both clients, causing this test to fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... I see. We're creating clients at the start, but not starting them until later... Would it be possible / make sense to just not create them until needed?

I'm a bit worried about making SpecTestRunner deviate too much from other platforms. If nothing else, it seems like we should have some "PORTING NOTE" comments if we're going to change how start() works here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a PORTING NOTE comment and moved this logic to an inner function (ensureRunner).

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for reworking.

@schmidt-sebastian schmidt-sebastian merged commit 463767b into firestore-multi-tab Mar 22, 2018
@schmidt-sebastian schmidt-sebastian deleted the multitab-activeclients branch March 26, 2018 21:32
@firebase firebase locked and limited conversation to collaborators Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants