This is an automated email from the ASF dual-hosted git repository.

rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 72a8bba  Changes the t3c process locking so that no two simultaneous 
t3c (#6341)
72a8bba is described below

commit 72a8bba4e7f609240d1b2f9062fa40815947f364
Author: John J. Rushford <[email protected]>
AuthorDate: Thu Nov 11 08:38:38 2021 -0700

    Changes the t3c process locking so that no two simultaneous t3c (#6341)
    
    instances run.  The locking now occurs befor t3c attempts logging
    into traffic ops.
---
 cache-config/t3c-apply/t3c-apply.go | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/cache-config/t3c-apply/t3c-apply.go 
b/cache-config/t3c-apply/t3c-apply.go
index 7498cb4..992cf80 100644
--- a/cache-config/t3c-apply/t3c-apply.go
+++ b/cache-config/t3c-apply/t3c-apply.go
@@ -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)
@@ -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))
 

Reply via email to