mirror of
https://github.com/golang/go.git
synced 2026-02-07 02:09:55 +00:00
net/http: use math/rand/v2 instead of math/rand
math/rand/v2 provides a more modern, performant, and secure random number API.
Change-Id: Ic0c30ae40623508e3ed65c435be3c208704b5655
GitHub-Last-Rev: a8fa520b39
GitHub-Pull-Request: golang/go#76433
Reviewed-on: https://go-review.googlesource.com/c/go/+/723680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
d2aad0df60
commit
0f9cdc2fbc
1 changed files with 2 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"maps"
|
||||
"math/rand"
|
||||
"math/rand/v2"
|
||||
"net"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
|
|
@ -3161,7 +3161,7 @@ func (s *Server) Shutdown(ctx context.Context) error {
|
|||
pollIntervalBase := time.Millisecond
|
||||
nextPollInterval := func() time.Duration {
|
||||
// Add 10% jitter.
|
||||
interval := pollIntervalBase + time.Duration(rand.Intn(int(pollIntervalBase/10)))
|
||||
interval := pollIntervalBase + time.Duration(rand.IntN(int(pollIntervalBase/10)))
|
||||
// Double and clamp for next time.
|
||||
pollIntervalBase *= 2
|
||||
if pollIntervalBase > shutdownPollIntervalMax {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue