Skip to content

Commit

Permalink
Changes the t3c process locking so that no two simultaneous t3c (#6341)
Browse files Browse the repository at this point in the history
instances run.  The locking now occurs befor t3c attempts logging
into traffic ops.
  • Loading branch information
jrushford authored Nov 11, 2021
1 parent df1ea8f commit 72a8bba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cache-config/t3c-apply/t3c-apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ func main() {
} else if cfg == (config.Cfg{}) { // user used the --help option
os.Exit(Success)
}
if !lock.GetLock("/var/run/t3c.lock") {
os.Exit(AlreadyRunning)
}

if cfg.UseGit == config.UseGitYes {
err := util.EnsureConfigDirIsGitRepo(cfg)
Expand Down Expand Up @@ -104,11 +107,6 @@ func main() {
log.Errorln("CleanTmpDir failed, cannot continue")
os.Exit(GeneralFailure)
}
if !cfg.ReportOnly {
if !lock.GetLock(config.TmpBase + "/to_ort.lock") {
os.Exit(AlreadyRunning)
}
}

log.Infoln(time.Now().Format(time.RFC3339))

Expand Down

0 comments on commit 72a8bba

Please sign in to comment.