Commit 38ebed5e authored by Alex Dadgar's avatar Alex Dadgar
Browse files

Review fixes

parent 050cdd5b
Showing with 3 additions and 6 deletions
+3 -6
......@@ -127,9 +127,9 @@ func (a *AllocGarbageCollector) keepUsageBelowThreshold() error {
func (a *AllocGarbageCollector) destroyAllocRunner(ar *AllocRunner) {
// Acquire the destroy lock
select {
case a.destroyCh <- struct{}{}:
case <-a.shutdownCh:
return
case a.destroyCh <- struct{}{}:
}
ar.Destroy()
......@@ -141,15 +141,12 @@ func (a *AllocGarbageCollector) destroyAllocRunner(ar *AllocRunner) {
a.logger.Printf("[DEBUG] client: garbage collected %q", ar.Alloc().ID)
select {
case <-a.destroyCh:
default:
}
// Release the lock
<-a.destroyCh
}
func (a *AllocGarbageCollector) Stop() {
close(a.shutdownCh)
close(a.destroyCh)
}
// Collect garbage collects a single allocation on a node
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment