-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CoroutineDispatcher.asScheduler for the Rx modules #3150
Conversation
9e00911
to
a13d99e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good
33667be
to
e43a152
Compare
Kover finds non-covered code in two places:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
schedulerJob.cancel() | ||
} | ||
|
||
private class DispatcherWorker(val counter: Long, val dispatcher: CoroutineDispatcher, parentJob: Job) : Worker() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[super optional] typically private
can save a getter and a setter
Runnable { scope.launch { task() } } | ||
} | ||
|
||
private val workerCounter = atomic(1L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[code style] it would be nice to both have a line indent here and to keep both properties and functions grouped separately, not mixing them all over the place
Also, * Don't use `kotlinx-coroutines-test` * Now shutting down the scheduler will interrupt the tasks
The test never did reliably pass, and it doesn't seem like there's anything in the Scheduler docs that mandates this behavior.
Remove cruft and ensure that they do actually fail if the tasks are not disposed of.
45cbda6
to
e79d8de
Compare
Merged manually to preserve authorship: d5f852c |
Supersedes #1923
Fixes #968
Fixes #548
Authored by @recheej