Skip to content

No way to stop SendLoop when used with time.Ticker #836

@jlordiales

Description

@jlordiales

The SendLoop func on many of the metric reporters takes in a <-chan time.Time and blocks until that channel is closed.
As the docs say, this is most typically used by creating a time.Ticker and passing its C channel.

This works great except for the fact that the C channel in the ticker can never be closed. You can call Stop on the ticker but this doesn't close the channel (golang/go#2650).
This effectively means that there's no straightforward way to return from the SendLoop func when used together with a time.Ticker.

I guess it would be nice if the func could take a ctx as first parameter and return when ctx.Done() is closed.

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