mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-31 00:52:35 +02:00
fix route reload
This commit is contained in:
parent
08236b582c
commit
2192120d0f
1 changed files with 4 additions and 5 deletions
|
@ -84,8 +84,10 @@ func (p *Provider) MarshalText() ([]byte, error) {
|
|||
func (p *Provider) startRoute(parent task.Parent, r *route.Route) E.Error {
|
||||
err := r.Start(parent)
|
||||
if err != nil {
|
||||
delete(p.routes, r.Alias)
|
||||
return err.Subject(r.Alias)
|
||||
}
|
||||
p.routes[r.Alias] = r
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -94,11 +96,8 @@ func (p *Provider) Start(parent task.Parent) E.Error {
|
|||
t := parent.Subtask("provider."+p.String(), false)
|
||||
|
||||
errs := E.NewBuilder("routes error")
|
||||
for alias, r := range p.routes {
|
||||
if err := p.startRoute(t, r); err != nil {
|
||||
errs.Add(err)
|
||||
delete(p.routes, alias)
|
||||
}
|
||||
for _, r := range p.routes {
|
||||
errs.Add(p.startRoute(t, r))
|
||||
}
|
||||
|
||||
eventQueue := events.NewEventQueue(
|
||||
|
|
Loading…
Add table
Reference in a new issue