Skip to content
This repository was archived by the owner on Feb 23, 2022. It is now read-only.

Don't use GlobalScope to launch flow and add cleanup method #2

Closed
sockeqwe opened this issue Oct 31, 2019 · 1 comment
Closed

Don't use GlobalScope to launch flow and add cleanup method #2

sockeqwe opened this issue Oct 31, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@sockeqwe
Copy link
Contributor

Let's create our own Scope and add a cleanup method to cancel the scope and release all recorded emissions.

@sockeqwe sockeqwe added the enhancement New feature or request label Oct 31, 2019
@sockeqwe
Copy link
Contributor Author

sockeqwe commented Nov 2, 2019

Added a .cleanUp() method and updated docs.

No now creating our own scope because one can pass its own scope as constructor parameter. If we would internally close the scope in cleanUp() we might close a scope that is used somewhere else too. To avoid that we don't introduce our own scope for now and just close the channels and Jobs used internally instead of going with closing a coroutine scope.

Another option is to could create our own coroutine scope and use it internally but don't allow consumers of this library to pass their own coroutine scope to launch the flow under test in it.

For now we go with the first option.

@sockeqwe sockeqwe closed this as completed Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant