From b5c7cf6ea88a9c22e56cf9278989281bb153029d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 11 Oct 2024 13:20:42 +0200 Subject: tools/syz-reprolist: fix throttling Throttling must be global, not per goroutine. --- tools/syz-reprolist/reprolist.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/syz-reprolist/reprolist.go b/tools/syz-reprolist/reprolist.go index 0c5f9eed1..1881c8465 100644 --- a/tools/syz-reprolist/reprolist.go +++ b/tools/syz-reprolist/reprolist.go @@ -364,6 +364,8 @@ func getFullBugList() ([]string, error) { return fullBugList, nil } +var throttler = time.NewTicker(time.Second).C + func getJSONBody(url string) ([]byte, error) { if strings.Contains(url, "?") { url = url + "&json=1" @@ -377,7 +379,7 @@ func getJSONBody(url string) ([]byte, error) { if *flagToken != "" { req.Header.Add("Authorization", "Bearer "+*flagToken) } else { - time.Sleep(time.Second) // tolerate throttling + <-throttler // tolerate throttling } client := &http.Client{} res, err := client.Do(req) -- cgit mrf-deployment