mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
fix 无法删除爬虫的问题
This commit is contained in:
@@ -126,7 +126,7 @@ func (s *Scheduler) Update() error {
|
||||
|
||||
// 添加到定时任务
|
||||
if err := s.AddJob(job); err != nil {
|
||||
log.Errorf("add job error: %s", err.Error())
|
||||
log.Errorf("add job error: %s, job: %s, cron: %s", err.Error(), job.Name, job.Cron)
|
||||
debug.PrintStack()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -45,11 +45,15 @@ func (s *SpiderSync) GetLockDownloadKey(spiderId string) string {
|
||||
|
||||
// 删除本地文件
|
||||
func (s *SpiderSync) RemoveSpiderFile() {
|
||||
//爬虫文件有变化,先删除本地文件
|
||||
_ = os.Remove(filepath.Join(
|
||||
path := filepath.Join(
|
||||
viper.GetString("spider.path"),
|
||||
s.Spider.Name,
|
||||
))
|
||||
)
|
||||
//爬虫文件有变化,先删除本地文件
|
||||
if err := os.RemoveAll(path); err != nil {
|
||||
log.Errorf("remove spider files error: %s, path: %s", err.Error(), path)
|
||||
debug.PrintStack()
|
||||
}
|
||||
}
|
||||
|
||||
// 检测是否已经下载中
|
||||
|
||||
Reference in New Issue
Block a user