rxjs-spy
rxjs-spy copied to clipboard
Invalid count between Subscribes and Unsubscribes
I want to implement an angular component to display in realtime the "live" observable count, but the count doesn't make sense (to me). For example, after a while playing with the app, I get in the console:
Stats
spy-core.js:362 Subscribes = 703
spy-core.js:364 Root subscribes = 70
spy-core.js:367 Leaf subscribes = 210
spy-core.js:370 Flattened subscribes = 163
spy-core.js:372 Unsubscribes = 705
spy-core.js:373 Nexts = 1921
spy-core.js:374 Errors = 20
spy-core.js:375 Completes = 579
spy-core.js:377 Max. depth = 18
spy-core.js:378 Avg. depth = 2.3
spy-core.js:380 Tick = 3928
spy-core.js:381 Timespan = 529001
How it is possible that I have more unsubscribes than subscribes?
The test file https://github.com/cartant/rxjs-spy/blob/master/source/plugin/stats-plugin-spec.ts is quite usefull to understand how things work, but it would be even better with some tests on the impact of errors on Unsubscribes or Completes counts.
Also, according to the test file, Subscribes = Root subscribes + Leaf subscribes + Flattened subscribes, but it doesn't seem to be the case.
unsubscribe
is idempotent, so I guess it depends upon where the count is incremented.
I've not worked on or used rxjs-spy
for some time, as I'm working on its successor - which does a better job. The subscribe
counts don't have to match up as the categories that are listed are exhaustive - i.e. there would be subscribes that are between the root and the leaf that aren't flattened and aren't shown.
I might look at this later. Maybe. But TBH I think any effort would be better directed elsewhere.
Ok, well I guess i'll wait for Rxjs Tools then, thanks.