mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 23:41:23 +02:00
refactor(state): replace Entrypoint method with ShortLinkMatcher interface
- Cleaned up agent go.mod by removing unused indirect dependencies.
This commit is contained in:
@@ -168,12 +168,12 @@ func (r *ReveseProxyRoute) Start(parent task.Parent) gperr.Error {
|
||||
} else {
|
||||
routes.HTTP.Add(r)
|
||||
if state := config.WorkingState.Load(); state != nil {
|
||||
state.Entrypoint().ShortLinkMatcher().AddRoute(r.Alias)
|
||||
state.ShortLinkMatcher().AddRoute(r.Alias)
|
||||
}
|
||||
r.task.OnCancel("remove_route", func() {
|
||||
routes.HTTP.Del(r)
|
||||
if state := config.WorkingState.Load(); state != nil {
|
||||
state.Entrypoint().ShortLinkMatcher().DelRoute(r.Alias)
|
||||
state.ShortLinkMatcher().DelRoute(r.Alias)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -216,12 +216,12 @@ func (r *ReveseProxyRoute) addToLoadBalancer(parent task.Parent) {
|
||||
linked.SetHealthMonitor(lb)
|
||||
routes.HTTP.AddKey(cfg.Link, linked)
|
||||
if state := config.WorkingState.Load(); state != nil {
|
||||
state.Entrypoint().ShortLinkMatcher().AddRoute(cfg.Link)
|
||||
state.ShortLinkMatcher().AddRoute(cfg.Link)
|
||||
}
|
||||
r.task.OnFinished("remove_loadbalancer_route", func() {
|
||||
routes.HTTP.DelKey(cfg.Link)
|
||||
if state := config.WorkingState.Load(); state != nil {
|
||||
state.Entrypoint().ShortLinkMatcher().DelRoute(cfg.Link)
|
||||
state.ShortLinkMatcher().DelRoute(cfg.Link)
|
||||
}
|
||||
})
|
||||
lbLock.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user