Skip to content

Commit ce11f78

Browse files
committed
fix(job): add retry for err
1 parent bdc0328 commit ce11f78

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/fc2/fc2daily.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ func (d *FC2) getFc2DailyFilm(fc2Id string) (model.EmbyFileObj, error) {
1616
collector := colly.NewCollector(func(c *colly.Collector) {
1717
c.SetRequestTimeout(time.Second * 10)
1818
})
19+
retryCount := 1
20+
collector.OnError(func(r *colly.Response, err error) {
21+
utils.Log.Infof("request failed, retryCount: %d", retryCount)
22+
if retryCount <= 3 {
23+
retryCount++
24+
err = r.Request.Retry()
25+
if err != nil {
26+
utils.Log.Warnf("retry failed: %s", err.Error())
27+
}
28+
}
29+
})
1930

2031
var actors []string
2132

drivers/fc2/job.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ func (d *FC2) reMatchReleaseTime() {
8585
if err1 != nil {
8686
utils.Log.Warnf("failed to update film info: %s", err1.Error())
8787
}
88+
virtual_file.UpdateNfo(virtual_file.MediaInfo{
89+
Source: "fc2",
90+
Dir: film.Actor,
91+
FileName: virtual_file.AppendImageName(film.Name),
92+
Release: film.Date,
93+
Title: film.Title,
94+
Actors: film.Actors,
95+
Tags: film.Tags,
96+
})
8897

8998
// avoid 429
9099
time.Sleep(time.Duration(d.ScanTimeLimit) * time.Second)

0 commit comments

Comments
 (0)