Skip to content

Commit

Permalink
Merge pull request #9 from ZenGo-X/feature/fix-subscriptions
Browse files Browse the repository at this point in the history
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
jeremyfelder authored Oct 12, 2020
2 parents d97c53e + 1033e63 commit d1d5493
Show file tree
Hide file tree
Showing 57 changed files with 1,463 additions and 7,929 deletions.
Binary file removed dist/.DS_Store
Binary file not shown.
14 changes: 0 additions & 14 deletions dist/lib/query/indexer-provider.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/lib/query/indexer-provider.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/lib/subscribe/polling-provider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/subscribe/polling-provider.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d1d5493

Please sign in to comment.