Reduce server console polling load

This commit is contained in:
npc0-hue
2026-09-07 19:49:20 +08:00
parent 1b583f3ca6
commit 4ab7bb820d
10 changed files with 110 additions and 25 deletions
+16 -1
View File
@@ -544,7 +544,22 @@ func matchRunEndpoint(endpoint domain.RunEndpoint, filter domain.RunEndpointFilt
func matchJob(job domain.Job, filter domain.JobFilter) bool {
return (filter.ServerInstanceID == "" || job.ServerInstanceID == filter.ServerInstanceID) &&
(filter.RunEndpointID == "" || job.RunEndpointID == filter.RunEndpointID) &&
(filter.State == "" || job.State == filter.State)
matchJobState(job.State, filter)
}
func matchJobState(state domain.JobState, filter domain.JobFilter) bool {
if filter.State != "" && state != filter.State {
return false
}
if len(filter.States) == 0 {
return true
}
for _, candidate := range filter.States {
if state == candidate {
return true
}
}
return false
}
func matchArtifact(artifact domain.Artifact, filter domain.ArtifactFilter) bool {