Skip to content

Return waitable future from Client::flush() #7

@ramosbugs

Description

@ramosbugs

Is your feature request related to a problem? Please describe.

Currently, Client provides a flush method that can be used to flush pending analytics events. However, there is no way to await the flush to ensure that analytics events have completed without calling Client::close to completely destroy the client.

For serverless use cases in particular, it would be very helpful to be able to ensure that analytics events have been reported before allowing the (e.g., AWS Lambda) function to suspend and wait for the next request (which might never come, in which case the analytics events would be dropped).

Describe the solution you'd like

Have flush return a Future. A straightforward way to do this is in Rust is via a channel (e.g., futures::channel::oneshot).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions