Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Add endpoint that exposes realm connection state and upload progress #84

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fealebenpae
Copy link
Member

No description provided.

src/service.ts Outdated
@@ -1079,6 +1097,16 @@ export class GraphQLService {
user,
});

this.state[path] = <any>{ connection: Realm.Sync.ConnectionState.Connected };

realm.syncSession.addConnectionNotification((state) => {
Copy link
Member

Choose a reason for hiding this comment

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

Should we remove these listeners when the Realm is closed?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're on the session, and that outlives the realm. Besides, when the session is destroyed it lets go of the listeners anyway.

Copy link
Member

Choose a reason for hiding this comment

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

My concern is that this will add a listener on every request. Perhaps node.js is clever and will recognize that this listener has already been added to the session, but if that's the case, it's not immediately obvious to me. If it's not clever though, I can easily see a long-lived Realm keeping a collection of thousands of listeners doing the same thing.

- Rename state to avoid clashing with IService.state
- Change route to be connectionStatus rather than synchronizing
- Move getConnection status above the graphql route to make sure it's handled properly
- Don't return 404s
@ianpward
Copy link

ianpward commented Dec 9, 2018

@fealebenpae @nirinchev Do we think we can complete this for this coming week? I have a meeting with Customer on Wednesday

@fealebenpae
Copy link
Member Author

fealebenpae commented Dec 10, 2018

@nirinchev and I had a brain-storming session today on how to proceed with the leaking listeners issue and we'll try to get this reviewed and merged by tomorrow so we can cut a release for Customer.

src/service.ts Outdated
@@ -1079,6 +1123,26 @@ export class GraphQLService {
user,
});

this.connectionStates[path] = {
Copy link
Member

Choose a reason for hiding this comment

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

We should not override this if it exists.

@ianpward
Copy link

ianpward commented Mar 6, 2019

can we merge this to master please? its been sitting since nov29 cc. @geragray

@nirinchev
Copy link
Member

It has some issues, which is why it hasn't been merged.

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