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
isValidated bool
lastError gperr.Error
started chan struct{}
}
Routes map[string]*Route
)
@ -218,6 +220,7 @@ func (r *Route) Validate() gperr.Error {
r.impl = impl
r.Excluded = r.ShouldExclude()
r.started = make(chan struct{})
return nil
}
@ -244,8 +247,10 @@ func (r *Route) Finish(reason any) {
r.impl = nil
}
func (r *Route) Started() bool {
return r.impl != nil
func (r *Route) Started() <-chan struct{} {
return r.started
}
}
func (r *Route) ProviderName() string {

View file

@ -27,7 +27,7 @@ type (
HealthMonitor() health.HealthMonitor
References() []string
Started() bool
Started() <-chan struct{}
IdlewatcherConfig() *idlewatcher.Config
HealthCheckConfig() *health.HealthCheckConfig