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

[RibCoroutineWorker] In asWorker(), keep scope alive until lifecycl… #625

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

psteiger
Copy link
Contributor

@psteiger psteiger commented Nov 21, 2023

…e completion.

This fixes Rx subscriptions using autoDispose(CoroutineScope) immediately terminating.

In order to properly support autoDispose(CoroutineScope) subscriptions, we must keep the CoroutineScope received in onStart alive as long as the WorkerScopeProvider lifecycle.

autoDispose does not create a child coroutine: instead it installs a completion handler. Hence, outer scope will not have children to wait for completion and will terminate immediately.

@psteiger psteiger force-pushed the asworker branch 2 times, most recently from 55eb7c9 to bef916d Compare November 21, 2023 00:16
…e completion.

This fixes Rx subscriptions using `autoDispose(CoroutineScope)` immediately terminating.

In order to properly support `autoDispose(CoroutineScope)` subscriptions, we must keep the `CoroutineScope` received in `onStart` alive as long as the `WorkerScopeProvider` lifecycle.

`autoDispose` does *not* create a children coroutine: instead it installs a completion handler. Hence, outer scope will not have children to wait for completion and will terminate immediately.
@psteiger psteiger merged commit 43db296 into uber:main Nov 21, 2023
2 checks passed
@psteiger psteiger deleted the asworker branch November 22, 2023 00:36
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

Successfully merging this pull request may close these issues.

2 participants