Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ZenGo-X/feature/fix-subscriptions
Fix npm run build Fix notifications issue, a cherry-pick from ZenGo-X/taquito@ec27554. Explanation: The newBlock$ event uses rxjs' publishReplay() + refCount(). This means that on every new subscription, the new listener gets all the events emitted prior to this subscription. Now, because our array of addresses to watch is dynamic - we always need to reset the subscription (i.e. delete it) and register a new subscription with a new filter containing the new address. This means that we get events for all prior blocks. Every parsing of such block, due to the large filter (array of many addresses), is time-consuming. This causes significant CPU spikes on our app and latency. Deleting publishReplay() and refCount() makes the new subscriber to get only the last block, and not all the previously emitted blocks.
- Loading branch information