diff --git a/assets/integrations/integrations.json b/assets/integrations/integrations.json index ab373c384..72875822c 100644 --- a/assets/integrations/integrations.json +++ b/assets/integrations/integrations.json @@ -53,7 +53,7 @@ "SourceCode": "https://github.com/opengovern/og-describer-github", "schema_ids": ["github"], "PackageURL": "ghcr.io/opengovern/og-describer-github", - "PackageTag": "local-v0.3.9" + "PackageTag": "local-v0.4.0" }, { "id": 5, diff --git a/services/describe/db/compliance_job.go b/services/describe/db/compliance_job.go index b34548c7c..538239c82 100644 --- a/services/describe/db/compliance_job.go +++ b/services/describe/db/compliance_job.go @@ -68,9 +68,10 @@ func (db Database) UpdateComplianceJobAreAllRunnersQueued(id uint, areAllRunners return nil } -func (db Database) UpdateComplianceJobsTimedOut(complianceIntervalHours int64) error { +func (db Database) UpdateComplianceJobsTimedOut(withIncidents bool, complianceIntervalHours int64) error { tx := db.ORM. Model(&model.ComplianceJob{}). + Where("with_incidents = ?", withIncidents). Where(fmt.Sprintf("created_at < NOW() - INTERVAL '%d MINUTES'", complianceIntervalHours)). Where("status IN ?", []string{string(model.ComplianceJobCreated), string(model.ComplianceJobRunnersInProgress), diff --git a/services/describe/schedulers/compliance-quick-run/publisher.go b/services/describe/schedulers/compliance-quick-run/publisher.go index 3f4f4a44a..a0b417949 100644 --- a/services/describe/schedulers/compliance-quick-run/publisher.go +++ b/services/describe/schedulers/compliance-quick-run/publisher.go @@ -17,7 +17,7 @@ func (s *JobScheduler) runPublisher(ctx context.Context) error { s.logger.Info("Query Runner publisher started") - err := s.db.UpdateComplianceJobsTimedOut(20) + err := s.db.UpdateComplianceJobsTimedOut(false, 20) if err != nil { s.logger.Error("failed to update timed out query runners", zap.Error(err)) } diff --git a/services/describe/schedulers/compliance/summarizer.go b/services/describe/schedulers/compliance/summarizer.go index e06e41e58..08a3e7460 100644 --- a/services/describe/schedulers/compliance/summarizer.go +++ b/services/describe/schedulers/compliance/summarizer.go @@ -76,7 +76,7 @@ func (s *JobScheduler) runSummarizer(ctx context.Context, manuals bool) error { return err } - err = s.db.UpdateComplianceJobsTimedOut(24 * 60) + err = s.db.UpdateComplianceJobsTimedOut(true, 24*60) if err != nil { s.logger.Error("failed to update compliance jobs timed out", zap.Error(err)) return err