From 050cdd5b14a8795030ec22bf2fef6e13413d734e Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Fri, 10 Mar 2017 16:46:22 -0800 Subject: [PATCH] remove escape --- client/gc.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/client/gc.go b/client/gc.go index 6199521b9..57770acff 100644 --- a/client/gc.go +++ b/client/gc.go @@ -14,10 +14,6 @@ import ( const ( // MB is a constant which converts values in bytes to MB MB = 1024 * 1024 - - // destroyWaitLimit is the timeout after which the max destroy parallelism - // is abandoned to continue to make progress - destroyWaitLimit = 3 * time.Minute ) // GCConfig allows changing the behaviour of the garbage collector @@ -130,12 +126,8 @@ func (a *AllocGarbageCollector) keepUsageBelowThreshold() error { // once the allocation has been destroyed. func (a *AllocGarbageCollector) destroyAllocRunner(ar *AllocRunner) { // Acquire the destroy lock - locked := false select { case a.destroyCh <- struct{}{}: - locked = true - case <-time.After(destroyWaitLimit): - a.logger.Printf("[WARN] client: garbage collecting contention when attempting destroy of allocation %q", ar.Alloc().ID) case <-a.shutdownCh: return } @@ -149,11 +141,9 @@ func (a *AllocGarbageCollector) destroyAllocRunner(ar *AllocRunner) { a.logger.Printf("[DEBUG] client: garbage collected %q", ar.Alloc().ID) - if locked { - select { - case <-a.destroyCh: - default: - } + select { + case <-a.destroyCh: + default: } }