tweak(route): start routes in parallel

This commit is contained in:
yusing 2025-06-03 23:32:59 +08:00
parent bdb3343a7c
commit 3135e377a9
2 changed files with 8 additions and 3 deletions

View file

@ -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 {

View file

@ -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