Skip to content

Commit

Permalink
Fix schedules are not deleted with spider #11
Browse files Browse the repository at this point in the history
  • Loading branch information
zkqiang committed Oct 4, 2020
1 parent 1333155 commit 1eeeae2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/services/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func QuerySchedulePage(page forms.PageForm) (total int, resultList []*results.Sc
}
}
if spider == nil {
return errors.New("spider not found")
continue
}
result.SpiderName = spider.Name
resultList = append(resultList, &result)
Expand Down
5 changes: 5 additions & 0 deletions backend/services/spider.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ func RemoveSpider(id uuid.UUID) (res interface{}, err error) {
return err
}

// 删除爬虫的所有定时调度
if err = tx.DeleteAllSchedulesWhereSpiderId(id); err != nil {
return err
}

// 删除版本文件
spiderDir := viper.GetString("spider.path")
dirs, _ := ioutil.ReadDir(spiderDir)
Expand Down

0 comments on commit 1eeeae2

Please sign in to comment.