Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait on correct Promise in subscription
I'm not a Promise expert, but the previous code at least read like it was possible for the Promise returned by subscribe to resolve once all the this.pubsub.subscribe Promises resolved but before all of the "push onto this.subscriptions" Promises resolved. If unsubscribe was called too quickly, you could in theory end up calling one of those "push" functions after the `delete this.subscriptions[subId]` line and crashing. In practice the old code does appear to work but this code more accurately shows the intentions.
- Loading branch information