Loading ui/build/proc_sync.go +14 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,14 @@ func BecomeSingletonOrFail(ctx Context, config Config) (lock *fileLock) { if err != nil { ctx.Logger.Fatal(err) } lockfilePollDuration := time.Second lockfileTimeout := time.Second * 10 if envTimeout := os.Getenv("SOONG_LOCK_TIMEOUT"); envTimeout != "" { lockfileTimeout, err = time.ParseDuration(envTimeout) if err != nil { ctx.Logger.Fatalf("failure parsing SOONG_LOCK_TIMEOUT %q: %s", envTimeout, err) } } err = lockSynchronous(*lockingInfo, newSleepWaiter(lockfilePollDuration, lockfileTimeout), ctx.Logger) if err != nil { ctx.Logger.Fatal(err) Loading @@ -41,9 +49,6 @@ func BecomeSingletonOrFail(ctx Context, config Config) (lock *fileLock) { return lockingInfo } var lockfileTimeout = time.Second * 10 var lockfilePollDuration = time.Second type lockable interface { tryLock() error Unlock() error Loading Loading @@ -80,15 +85,18 @@ func lockSynchronous(lock lockable, waiter waiter, logger logger.Logger) (err er return nil } waited = true done, description := waiter.checkDeadline() if !waited { logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description()) } waited = true if done { return fmt.Errorf("Tried to lock %s, but timed out %s . Make sure no other Soong process is using it", lock.description(), waiter.summarize()) } else { logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description()) waiter.wait() } } Loading Loading
ui/build/proc_sync.go +14 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,14 @@ func BecomeSingletonOrFail(ctx Context, config Config) (lock *fileLock) { if err != nil { ctx.Logger.Fatal(err) } lockfilePollDuration := time.Second lockfileTimeout := time.Second * 10 if envTimeout := os.Getenv("SOONG_LOCK_TIMEOUT"); envTimeout != "" { lockfileTimeout, err = time.ParseDuration(envTimeout) if err != nil { ctx.Logger.Fatalf("failure parsing SOONG_LOCK_TIMEOUT %q: %s", envTimeout, err) } } err = lockSynchronous(*lockingInfo, newSleepWaiter(lockfilePollDuration, lockfileTimeout), ctx.Logger) if err != nil { ctx.Logger.Fatal(err) Loading @@ -41,9 +49,6 @@ func BecomeSingletonOrFail(ctx Context, config Config) (lock *fileLock) { return lockingInfo } var lockfileTimeout = time.Second * 10 var lockfilePollDuration = time.Second type lockable interface { tryLock() error Unlock() error Loading Loading @@ -80,15 +85,18 @@ func lockSynchronous(lock lockable, waiter waiter, logger logger.Logger) (err er return nil } waited = true done, description := waiter.checkDeadline() if !waited { logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description()) } waited = true if done { return fmt.Errorf("Tried to lock %s, but timed out %s . Make sure no other Soong process is using it", lock.description(), waiter.summarize()) } else { logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description()) waiter.wait() } } Loading