Re: [webrtc-stats] Adding minor clarification regarding stats object lifetime.

We don't want the caller to miss out on stats that may be of interest.
 But an hour old 1-second data channel does not sound very 
interesting. _If_ we want to stop it from growing indefinitely we 
could either:
1. After an object is deleted, return its stats object the next time 
getStats is called and then remove it from the cache.
2. Have an API for clearing deleted stats.
3. Have a time limit, say if an object was removed >1 minute ago we 
remove it from the stats cache. The caller(s) would have had plenty of
 time to get it if they were interested in it.

1+2 will not fly because we are agnostic to how many callers there are
 to getStats and these would interfer with other callers. 2 is also 
racey unless you explicitly state what to clear, this would be a bad 
API IMO. Also problem with 1+2 is if you don't call this the stats 
cache (memory) keeps growing indefinitely.

What about 3?

If someone is interested in the complete history of stats objects they
 could cache all detached/removed stats themselves, I think that is an
 unusual usage case but it would be easy to do for anyone interested.

GitHub Notification of comment by henbos
Please view or discuss this issue at 
using your GitHub account

Received on Wednesday, 11 January 2017 10:57:12 UTC