Refactor: extract function to look up waiting channel for container
This commit is contained in:
1 parent
4e48b956d9
commit
5993b3e846
1 file changed
+9
-7
+9
-7
@@ -438,18 +438,20 @@ func (proxy *Proxy) waitForStart(r *http.Request) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If some other operation is waiting for a container to start, join in the wait
|
func (proxy *Proxy) waitChan(ident string) chan error {
|
||||||
func (proxy *Proxy) waitForStartByIdent(ident string) error {
|
|
||||||
var ch chan error
|
|
||||||
proxy.Lock()
|
proxy.Lock()
|
||||||
|
defer proxy.Unlock()
|
||||||
for _, wait := range proxy.waiters {
|
for _, wait := range proxy.waiters {
|
||||||
if ident == wait.ident && !wait.done {
|
if ident == wait.ident && !wait.done {
|
||||||
ch = wait.ch
|
return wait.ch
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxy.Unlock()
|
return nil
|
||||||
if ch != nil {
|
}
|
||||||
|
|
||||||
|
// If some other operation is waiting for a container to start, join in the wait
|
||||||
|
func (proxy *Proxy) waitForStartByIdent(ident string) error {
|
||||||
|
if ch := proxy.waitChan(ident); ch != nil {
|
||||||
Log.Debugf("Wait for start of container %s", ident)
|
Log.Debugf("Wait for start of container %s", ident)
|
||||||
return <-ch
|
return <-ch
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user