Skip to content

Commit

Permalink
chore(anchor): remove not started alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 committed Jan 2, 2023
1 parent 2c24d84 commit 4e7d672
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 54 deletions.
1 change: 0 additions & 1 deletion cd/manager/env/.env.prod
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
SMOKE_TEST_INTERVAL=6h
CAS_MAX_ANCHOR_INTERVAL=6h
ENV=prod
1 change: 0 additions & 1 deletion cd/manager/env/.env.qa
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SMOKE_TEST_INTERVAL=6h
E2E_TEST_INTERVAL=8h
CAS_MAX_ANCHOR_INTERVAL=6h
ENV=qa
1 change: 0 additions & 1 deletion cd/manager/env/.env.tnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
SMOKE_TEST_INTERVAL=6h
CAS_MAX_ANCHOR_INTERVAL=6h
ENV=tnet
18 changes: 0 additions & 18 deletions cd/manager/jobmanager/jobManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/3box/pipeline-tools/cd/manager"
"github.com/3box/pipeline-tools/cd/manager/jobs"
"github.com/3box/pipeline-tools/cd/manager/notifs"
)

var _ manager.Manager = &JobManager{}
Expand Down Expand Up @@ -140,9 +139,6 @@ func (m *JobManager) processJobs() {
if err := m.scheduleTests(); err != nil {
log.Printf("processJobs: error scheduling tests: %v", err)
}
if err := m.checkAnchorInterval(); err != nil {
log.Printf("processJobs: error checking anchor job interval: %v", err)
}
// Don't start any new jobs if the job manager is paused. Existing jobs will continue to be advanced.
if !m.paused {
// Always check if we have anchor jobs, even if none were dequeued. This is because we might have a minimum
Expand Down Expand Up @@ -231,20 +227,6 @@ func (m *JobManager) scheduleTests() error {
return nil
}

func (m *JobManager) checkAnchorInterval() error {
// Check time since the last anchor job was completed, if there isn't an anchor job already running.
activeAnchors := m.cache.JobsByMatcher(func(js manager.JobState) bool {
return manager.IsActiveJob(js) && (js.Type == manager.JobType_Anchor)
})
if len(activeAnchors) == 0 {
return m.checkJobInterval(manager.JobType_Anchor, manager.JobStage_Completed, "CAS_MAX_ANCHOR_INTERVAL", func(ts time.Time) error {
notifs.NewAnchorIntervalNotif(m.notifs).SendAlert(ts)
return nil
})
}
return nil
}

func (m *JobManager) checkJobInterval(jobType manager.JobType, jobStage manager.JobStage, intervalEnv string, processFn func(time.Time) error) error {
if interval, found := os.LookupEnv(intervalEnv); found {
if parsedInterval, err := time.ParseDuration(interval); err != nil {
Expand Down
33 changes: 0 additions & 33 deletions cd/manager/notifs/anchorInterval.go

This file was deleted.

0 comments on commit 4e7d672

Please sign in to comment.