golang/go

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

Open

#54.082 aperta il 27 lug 2022

Vedi su GitHub
 (9 commenti) (1 reazione) (0 assegnatari)Go (19.008 fork)batch import
DocumentationNeedsInvestigationhelp wanted

Metriche repository

Star
 (133.883 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor