mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
provider update race fix attempt
This commit is contained in:
parent
a2ada5c7ea
commit
110bb362b3
2 changed files with 4 additions and 3 deletions
BIN
bin/go-proxy
BIN
bin/go-proxy
Binary file not shown.
|
@ -41,11 +41,12 @@ func (p *Provider) StopAllRoutes() {
|
|||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
|
||||
if !p.needUpdate() {
|
||||
if p.stopWatching == nil {
|
||||
return
|
||||
}
|
||||
|
||||
close(p.stopWatching)
|
||||
p.stopWatching = nil
|
||||
if p.dockerClient != nil {
|
||||
p.dockerClient.Close()
|
||||
}
|
||||
|
@ -73,7 +74,6 @@ func (p *Provider) BuildStartRoutes() {
|
|||
}
|
||||
|
||||
p.lastUpdate = time.Now()
|
||||
p.stopWatching = make(chan struct{})
|
||||
p.routes = make(map[string]Route)
|
||||
|
||||
cfgs, err := p.GetProxyConfigs()
|
||||
|
@ -94,6 +94,7 @@ func (p *Provider) BuildStartRoutes() {
|
|||
}
|
||||
p.WatchChanges()
|
||||
p.Logf("Build", "built %d routes", len(p.routes))
|
||||
p.stopWatching = make(chan struct{})
|
||||
}
|
||||
|
||||
func (p *Provider) WatchChanges() {
|
||||
|
|
Loading…
Add table
Reference in a new issue