Skip to content

Commit 2337d6f

Browse files
authored
fix: Fix clam scan status display abnormality issue (#11722)
Refs #11686
1 parent cb8ecd5 commit 2337d6f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ core/xpack
4949
core/router/entry_xpack.go
5050
core/server/init_xpack.go
5151
core/utils/xpack/xpack_xpack.go
52+
core/xpack-ee
53+
core/router/entry_xpack_ee.go
54+
core/server/init_xpack_ee.go
55+
core/utils/xpack/xpack_xpack_ee.go
5256
xpack
5357

5458
.history/

agent/app/service/clam.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (c *ClamService) LoadBaseInfo() (dto.ClamBaseInfo, error) {
9696
}
9797
}
9898
} else {
99-
_ = clam.StopAllClamJob(false, clamRepo)
99+
_ = clam.CheckWithStopAll(false, clamRepo)
100100
}
101101
if baseInfo.FreshIsActive {
102102
version, err := cmd.RunDefaultWithStdoutBashC("freshclam --version")
@@ -313,7 +313,7 @@ func (c *ClamService) Delete(req dto.ClamDelete) error {
313313
}
314314

315315
func (c *ClamService) HandleOnce(id uint) error {
316-
if active := clam.StopAllClamJob(true, clamRepo); !active {
316+
if active := clam.CheckWithStopAll(true, clamRepo); !active {
317317
return buserr.New("ErrClamdscanNotFound")
318318
}
319319
clamItem, _ := clamRepo.Get(repo.WithByID(id))

agent/utils/clam/clam.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ func AnalysisFromLog(pathItem string, record *model.ClamRecord) {
6363
}
6464
}
6565

66-
func StopAllClamJob(withCheck bool, clamRepo repo.IClamRepo) bool {
66+
func CheckWithStopAll(withCheck bool, clamRepo repo.IClamRepo) bool {
6767
if withCheck {
6868
isExist, _ := controller.CheckExist("clam")
6969
if !isExist {
7070
return false
7171
}
7272
isActive, _ := controller.CheckActive("clam")
73-
if !isActive {
74-
return false
73+
if isActive {
74+
return true
7575
}
7676
}
7777
clams, _ := clamRepo.List(repo.WithByStatus(constant.StatusEnable))
7878
for i := 0; i < len(clams); i++ {
7979
global.Cron.Remove(cron.EntryID(clams[i].EntryID))
8080
_ = clamRepo.Update(clams[i].ID, map[string]interface{}{"status": constant.StatusDisable, "entry_id": 0})
8181
}
82-
return true
82+
return false
8383
}

0 commit comments

Comments
 (0)