加入检测scrapy配置

This commit is contained in:
marvzhang
2020-03-12 09:21:55 +08:00
parent 19dda39931
commit ee8279263d
3 changed files with 11 additions and 7 deletions

View File

@@ -44,6 +44,7 @@ setting:
enableTutorial: "N"
runOnMaster: "Y"
demoSpiders: "N"
checkScrapy: "Y"
notification:
mail:
server: ''

View File

@@ -45,13 +45,15 @@ func (s *SpiderSync) CheckIsScrapy() {
if s.Spider.Type == constants.Configurable {
return
}
if viper.GetString("setting.checkScrapy") != "Y" {
return
}
s.Spider.IsScrapy = utils.Exists(path.Join(s.Spider.Src, "scrapy.cfg"))
// TODO: 暂时停用自动检测Scrapy项目功能
//if err := s.Spider.Save(); err != nil {
// log.Errorf(err.Error())
// debug.PrintStack()
// return
//}
if err := s.Spider.Save(); err != nil {
log.Errorf(err.Error())
debug.PrintStack()
return
}
}
func (s *SpiderSync) AfterRemoveDownCreate() {