Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ core/xpack
core/router/entry_xpack.go
core/server/init_xpack.go
core/utils/xpack/xpack_xpack.go
core/xpack-ee
core/router/entry_xpack_ee.go
core/server/init_xpack_ee.go
core/utils/xpack/xpack_xpack_ee.go
xpack

.history/
Expand Down
4 changes: 2 additions & 2 deletions agent/app/service/clam.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (c *ClamService) LoadBaseInfo() (dto.ClamBaseInfo, error) {
}
}
} else {
_ = clam.StopAllClamJob(false, clamRepo)
_ = clam.CheckWithStopAll(false, clamRepo)
}
if baseInfo.FreshIsActive {
version, err := cmd.RunDefaultWithStdoutBashC("freshclam --version")
Expand Down Expand Up @@ -313,7 +313,7 @@ func (c *ClamService) Delete(req dto.ClamDelete) error {
}

func (c *ClamService) HandleOnce(id uint) error {
if active := clam.StopAllClamJob(true, clamRepo); !active {
if active := clam.CheckWithStopAll(true, clamRepo); !active {
return buserr.New("ErrClamdscanNotFound")
}
clamItem, _ := clamRepo.Get(repo.WithByID(id))
Expand Down
8 changes: 4 additions & 4 deletions agent/utils/clam/clam.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ func AnalysisFromLog(pathItem string, record *model.ClamRecord) {
}
}

func StopAllClamJob(withCheck bool, clamRepo repo.IClamRepo) bool {
func CheckWithStopAll(withCheck bool, clamRepo repo.IClamRepo) bool {
if withCheck {
isExist, _ := controller.CheckExist("clam")
if !isExist {
return false
}
isActive, _ := controller.CheckActive("clam")
if !isActive {
return false
if isActive {
return true
}
}
clams, _ := clamRepo.List(repo.WithByStatus(constant.StatusEnable))
for i := 0; i < len(clams); i++ {
global.Cron.Remove(cron.EntryID(clams[i].EntryID))
_ = clamRepo.Update(clams[i].ID, map[string]interface{}{"status": constant.StatusDisable, "entry_id": 0})
}
return true
return false
}
Loading