Skip to content

sample should not start sampling until after the first element is received #2655

Open
@jonschmidt

Description

@jonschmidt

I don't think the sampling of Flow.sample() should start until after the first element is received. There is even a comment to back that up:
https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/flow/operators/Delay.kt#L298

I am currently running into this problem as I am sampling user drag input and sending network requests to do geo-location. I am using sample to not send too many requests, but it seems that it is delaying the first request as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions