Wait for page download failures
This commit is contained in:
parent
95fa44fb97
commit
776ca68e3e
13
cv/cv.go
13
cv/cv.go
@ -193,6 +193,7 @@ func (c *CVDownloader) updateIssues() {
|
|||||||
if failCount > 2 {
|
if failCount > 2 {
|
||||||
sleepTime = time.Minute * 10
|
sleepTime = time.Minute * 10
|
||||||
}
|
}
|
||||||
|
log.Println("This page failed to download, lets wait for", sleepTime, "and hope it works")
|
||||||
select {
|
select {
|
||||||
case <-c.Context.Done(): // allows us to return immediately even during a timeout
|
case <-c.Context.Done(): // allows us to return immediately even during a timeout
|
||||||
return false
|
return false
|
||||||
@ -263,6 +264,18 @@ func (c *CVDownloader) updateIssues() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
cancelDownloadCTX()
|
||||||
|
if retry(URI.String(), nil) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Println("Failed to download this page, we'll wait for an hour to see if it clears up")
|
||||||
|
select {
|
||||||
|
case <-c.Context.Done(): // allows us to return immediately even during a timeout
|
||||||
|
return
|
||||||
|
case <-time.After(1 * time.Hour):
|
||||||
|
}
|
||||||
|
}
|
||||||
file, err := os.Create(filepath.Join(c.JSONPath, "cv-"+strconv.Itoa(offset)+".json"))
|
file, err := os.Create(filepath.Join(c.JSONPath, "cv-"+strconv.Itoa(offset)+".json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user