mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 07:21:26 +02:00
performance improvement and small fix on loadbalancer
This commit is contained in:
@@ -52,12 +52,12 @@ func (p FileProvider) OnEvent(event W.Event, routes R.Routes) (res EventResult)
|
||||
return
|
||||
}
|
||||
|
||||
routes.RangeAll(func(_ string, v R.Route) {
|
||||
routes.RangeAllParallel(func(_ string, v R.Route) {
|
||||
b.Add(v.Stop())
|
||||
})
|
||||
routes.Clear()
|
||||
|
||||
newRoutes.RangeAll(func(_ string, v R.Route) {
|
||||
newRoutes.RangeAllParallel(func(_ string, v R.Route) {
|
||||
b.Add(v.Start())
|
||||
})
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ func (p *Provider) StartAllRoutes() (res E.NestedError) {
|
||||
nStarted := 0
|
||||
nFailed := 0
|
||||
|
||||
p.routes.RangeAll(func(alias string, r R.Route) {
|
||||
p.routes.RangeAllParallel(func(alias string, r R.Route) {
|
||||
if err := r.Start(); err.HasError() {
|
||||
errors.Add(err.Subject(r))
|
||||
nFailed++
|
||||
@@ -138,7 +138,7 @@ func (p *Provider) StopAllRoutes() (res E.NestedError) {
|
||||
|
||||
nStopped := 0
|
||||
nFailed := 0
|
||||
p.routes.RangeAll(func(alias string, r R.Route) {
|
||||
p.routes.RangeAllParallel(func(alias string, r R.Route) {
|
||||
if err := r.Stop(); err.HasError() {
|
||||
errors.Add(err.Subject(r))
|
||||
nFailed++
|
||||
|
||||
Reference in New Issue
Block a user