Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid count between Subscribes and Unsubscribes #54

Open
P3tronius opened this issue Jun 11, 2020 · 2 comments
Open

Invalid count between Subscribes and Unsubscribes #54

P3tronius opened this issue Jun 11, 2020 · 2 comments

Comments

@P3tronius
Copy link

P3tronius commented Jun 11, 2020

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.

@cartant
Copy link
Owner

cartant commented Jun 11, 2020

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.

@P3tronius
Copy link
Author

Ok, well I guess i'll wait for Rxjs Tools then, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants