mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-07 12:02:34 +02:00
tweak(route): start routes in parallel
This commit is contained in:
parent
bdb3343a7c
commit
3135e377a9
2 changed files with 8 additions and 3 deletions
|
@ -69,6 +69,8 @@ type (
|
||||||
impl routes.Route
|
impl routes.Route
|
||||||
isValidated bool
|
isValidated bool
|
||||||
lastError gperr.Error
|
lastError gperr.Error
|
||||||
|
|
||||||
|
started chan struct{}
|
||||||
}
|
}
|
||||||
Routes map[string]*Route
|
Routes map[string]*Route
|
||||||
)
|
)
|
||||||
|
@ -218,6 +220,7 @@ func (r *Route) Validate() gperr.Error {
|
||||||
|
|
||||||
r.impl = impl
|
r.impl = impl
|
||||||
r.Excluded = r.ShouldExclude()
|
r.Excluded = r.ShouldExclude()
|
||||||
|
r.started = make(chan struct{})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +247,10 @@ func (r *Route) Finish(reason any) {
|
||||||
r.impl = nil
|
r.impl = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route) Started() bool {
|
func (r *Route) Started() <-chan struct{} {
|
||||||
return r.impl != nil
|
return r.started
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route) ProviderName() string {
|
func (r *Route) ProviderName() string {
|
||||||
|
|
|
@ -27,7 +27,7 @@ type (
|
||||||
HealthMonitor() health.HealthMonitor
|
HealthMonitor() health.HealthMonitor
|
||||||
References() []string
|
References() []string
|
||||||
|
|
||||||
Started() bool
|
Started() <-chan struct{}
|
||||||
|
|
||||||
IdlewatcherConfig() *idlewatcher.Config
|
IdlewatcherConfig() *idlewatcher.Config
|
||||||
HealthCheckConfig() *health.HealthCheckConfig
|
HealthCheckConfig() *health.HealthCheckConfig
|
||||||
|
|
Loading…
Add table
Reference in a new issue