MCPcopy
hub / github.com/ChineseSubFinder/ChineseSubFinder / afterRead

Method afterRead

pkg/task_queue/task_queue.go:367–388  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

365}
366
367func (t *TaskQueue) afterRead() {
368 // 将 downloading 的任务重置为 waiting
369 for TaskPriority := 0; TaskPriority <= taskPriorityCount; TaskPriority++ {
370 t.taskPriorityMapList[TaskPriority].Each(func(key interface{}, value interface{}) {
371
372 nowOneJob := value.(task_queue2.OneJob)
373 if nowOneJob.JobStatus == task_queue2.Downloading {
374 nowOneJob.JobStatus = task_queue2.Waiting
375 nowOneJob.DownloadTimes += 1
376 bok, err := t.update(nowOneJob)
377 if err != nil {
378 t.log.Errorln("afterRead.update failed", err)
379 return
380 }
381 if bok == false {
382 t.log.Errorln("afterRead.update failed")
383 return
384 }
385 }
386 })
387 }
388}
389
390// save 需要把改变的数据保持到 K/V 数据库中,这个没有锁,所以需要在 Sync 中使用,不对外开放
391func (t *TaskQueue) save(taskPriority int) error {

Callers 1

NewTaskQueueFunction · 0.95

Calls 1

updateMethod · 0.95

Tested by

no test coverage detected