Skip to content

time: example of After includes a bad practice #43009

@snadrus

Description

@snadrus

Does this issue reproduce with the latest release? Yes

What operating system? All

What did you do?

Used the time.After example in production, specifically:
case <-time.Now().After(5*time.Minute):

What did you expect to see?

A sensible scaling of the example as load increased.

What did you see instead?

https://medium.com/@oboturov/golang-time-after-is-not-garbage-collected-4cbc94740082
Using this in a switch clause fails to account for the lack of on-demand garbage collection (documented) which (at scale) becomes a problem consuming GB of memory and causing GC churn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions