feat: 抓取期间每 60 秒打一次进度心跳
单场秀几百张图要抓几十分钟,期间 done 不变。 后台按「progress_at 超过 10 分钟没变」判卡死,会把正常但慢的抓取误报成卡死。 心跳只刷新时间戳,不改进度数字。
This commit is contained in:
17
cmd/serve.go
17
cmd/serve.go
@ -133,6 +133,23 @@ func executeBrand(ctx context.Context, taskID uint32, brandUID, brandName string
|
||||
if config.GlobalConfig.Media.Upload && IngestClient != nil {
|
||||
s.Media = media.New(IngestClient, "runway", config.GlobalConfig.Media.Concurrency)
|
||||
}
|
||||
// 心跳:单场秀可能有几百张图,一抓就是几十分钟,期间进度数字不会变。
|
||||
// 没有它,后台会按「progress_at 超过 10 分钟没变」把正常抓取误判成卡死。
|
||||
stop := make(chan struct{})
|
||||
go func() {
|
||||
t := time.NewTicker(60 * time.Second)
|
||||
defer t.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-stop:
|
||||
return
|
||||
case <-t.C:
|
||||
s.Heartbeat()
|
||||
}
|
||||
}
|
||||
}()
|
||||
defer close(stop)
|
||||
|
||||
shows = s.RunBrand(brandUID, brandName, maxShows)
|
||||
return shows, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user