network icon indicating copy to clipboard operation
network copied to clipboard

test(client): Break from message iteration loop

Open teogeb opened this issue 3 years ago • 0 comments

Summary

Added test case which demonstrates how subscription is automatically unsubscribed if user iterates it and breaks out of loop. It is not clear whether this is a good functionality? Or should we keep the subscription active unless use explicitly unsubscribes that? (Do we support e.g. multiple iterations from a single subscription, or should we support?)

This auto-close is maybe done in other scenarios, e.g. if we call internal collect(n).

Most this doesn't apply to situations where we'd iterate all messages from an iterator?

  • All iterators for realtime subscription are infinite so we most likely can't automatically close it by iterating it to the end (as it doesn't end).
  • Resends are not (yet) subscriptions. But if change the semantics in that way, could check whether iterating all messages would auto-return() the iterable.

teogeb avatar Oct 21 '22 11:10 teogeb