mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-22 16:28:30 +02:00
add delay after error while watching change fix
This commit is contained in:
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/golang/glog"
|
||||
@@ -18,7 +17,6 @@ type Provider struct {
|
||||
routes map[string]Route // id -> Route
|
||||
dockerClient *client.Client
|
||||
mutex sync.Mutex
|
||||
lastUpdate time.Time
|
||||
}
|
||||
|
||||
func (p *Provider) GetProxyConfigs() ([]*ProxyConfig, error) {
|
||||
@@ -33,10 +31,6 @@ func (p *Provider) GetProxyConfigs() ([]*ProxyConfig, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Provider) needUpdate() bool {
|
||||
return p.lastUpdate.Add(1 * time.Second).Before(time.Now())
|
||||
}
|
||||
|
||||
func (p *Provider) StopAllRoutes() {
|
||||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
@@ -69,11 +63,6 @@ func (p *Provider) BuildStartRoutes() {
|
||||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
|
||||
if !p.needUpdate() {
|
||||
return
|
||||
}
|
||||
|
||||
p.lastUpdate = time.Now()
|
||||
p.routes = make(map[string]Route)
|
||||
|
||||
cfgs, err := p.GetProxyConfigs()
|
||||
|
||||
Reference in New Issue
Block a user