fix: update_interval = 0 if that is error

This commit is contained in:
eson 2020-09-15 10:39:34 +08:00
parent 072468005c
commit 36c277c3ce

View File

@ -189,9 +189,11 @@ func main() {
for _, streamer := range streamers {
Extractor(wd, streamer)
streamer.UpdateTime = &sql.NullTime{Time: time.Now(), Valid: true}
if err = intimate.TStreamer.InsertOrUpdate(streamer,
intimate.DUpdate{Field: "tags"},
intimate.DUpdate{Field: "update_time"},
intimate.DUpdate{Field: "update_interval"},
); err != nil {
log.Println(err)
}
@ -254,13 +256,15 @@ func Extractor(wd selenium.WebDriver, streamer *intimate.Streamer) {
if err == nil {
log.Println(*streamer.UserId, "may be cancell")
streamer.Operator = 5
streamer.UpdateTime = &sql.NullTime{Time: time.Now(), Valid: true}
intimate.TStreamer.UpdateError(streamer, fmt.Errorf(*streamer.UserId, "may be cancell"))
}
return
}
err = extractFollowers(wd, clog)
if err != nil {
// log.Println(err)
streamer.UpdateInterval += 30
return
}