mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-24 10:01:04 +01:00
fix(route): properly cleanup task on error
This commit is contained in:
@@ -128,7 +128,9 @@ func (s *FileServer) Start(parent task.Parent) gperr.Error {
|
||||
|
||||
ep := entrypoint.FromCtx(parent.Context())
|
||||
if ep == nil {
|
||||
return gperr.New("entrypoint not initialized")
|
||||
err := gperr.New("entrypoint not initialized")
|
||||
s.task.Finish(err)
|
||||
return err
|
||||
}
|
||||
ep.AddRoute(s)
|
||||
return nil
|
||||
|
||||
@@ -165,7 +165,9 @@ func (r *ReveseProxyRoute) Start(parent task.Parent) gperr.Error {
|
||||
|
||||
ep := entrypoint.FromCtx(parent.Context())
|
||||
if ep == nil {
|
||||
return gperr.New("entrypoint not initialized")
|
||||
err := gperr.New("entrypoint not initialized")
|
||||
r.task.Finish(err)
|
||||
return err
|
||||
}
|
||||
|
||||
if r.UseLoadBalance() {
|
||||
|
||||
@@ -84,7 +84,9 @@ func (r *StreamRoute) Start(parent task.Parent) gperr.Error {
|
||||
|
||||
ep := entrypoint.FromCtx(parent.Context())
|
||||
if ep == nil {
|
||||
return gperr.New("entrypoint not initialized")
|
||||
err := gperr.New("entrypoint not initialized")
|
||||
r.task.Finish(err)
|
||||
return err
|
||||
}
|
||||
ep.AddRoute(r)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user