File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,9 @@ func query(url string) (*apischema.CVEAPIJSON20, error) {
128128 if err != nil {
129129 return nil , fmt .Errorf ("creating HTTP request: %w" , err )
130130 }
131- req .Header .Set ("apiKey" , os .Getenv ("NVD_API_KEY" ))
131+ if apiKey := os .Getenv ("NVD_API_KEY" ); apiKey != "" {
132+ req .Header .Set ("apiKey" , os .Getenv ("NVD_API_KEY" ))
133+ }
132134
133135 apiResp , err := queryWithBackoff (req )
134136 if err != nil {
@@ -153,8 +155,8 @@ func queryWithBackoff(req *http.Request) (*apischema.CVEAPIJSON20, error) {
153155 }
154156 }
155157 log .Warnf ("Failed query attempt %d for %s: %v" , i , req .URL .String (), err )
156- // Wait some multiple of 3 seconds before next attempt.
157- time .Sleep (time .Duration (3 * i ) * time .Second )
158+ // Wait some multiple of 6 seconds before next attempt.
159+ time .Sleep (time .Duration (6 * i ) * time .Second )
158160 }
159161
160162 return apiResp , err
You can’t perform that action at this time.
0 commit comments