golang/go

x/time/rate: document the behavior of negative n

Open

#54.082 aberto em 27 de jul. de 2022

Ver no GitHub
 (9 comments) (1 reaction) (0 assignees)Go (19.008 forks)batch import
DocumentationNeedsInvestigationhelp wanted

Métricas do repositório

Stars
 (133.883 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

The methods AllowN, ReserveN, WaitN take in a user-specified number of tokens to take. The documentation does not specify what happens when the number of tokens is negative.

Without digging into the details, it appears that you can actually specify a negative n, in which case it returns that number of tokens to the rate limiter.

Guia do colaborador