mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
chore(api): remove debug task list endpoint
This commit is contained in:
parent
0d859cc36f
commit
2b44ac5bcb
3 changed files with 1 additions and 15 deletions
|
@ -13,7 +13,6 @@ import (
|
||||||
"github.com/yusing/go-proxy/internal/net/gphttp/middleware"
|
"github.com/yusing/go-proxy/internal/net/gphttp/middleware"
|
||||||
"github.com/yusing/go-proxy/internal/route/routes/routequery"
|
"github.com/yusing/go-proxy/internal/route/routes/routequery"
|
||||||
route "github.com/yusing/go-proxy/internal/route/types"
|
route "github.com/yusing/go-proxy/internal/route/types"
|
||||||
"github.com/yusing/go-proxy/internal/task"
|
|
||||||
"github.com/yusing/go-proxy/internal/utils"
|
"github.com/yusing/go-proxy/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,7 +27,6 @@ const (
|
||||||
ListRouteProviders = "route_providers"
|
ListRouteProviders = "route_providers"
|
||||||
ListHomepageCategories = "homepage_categories"
|
ListHomepageCategories = "homepage_categories"
|
||||||
ListIcons = "icons"
|
ListIcons = "icons"
|
||||||
ListTasks = "tasks"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
|
func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -76,8 +74,6 @@ func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
|
||||||
icons = []string{}
|
icons = []string{}
|
||||||
}
|
}
|
||||||
gphttp.RespondJSON(w, r, icons)
|
gphttp.RespondJSON(w, r, icons)
|
||||||
case ListTasks:
|
|
||||||
gphttp.RespondJSON(w, r, task.DebugTaskList())
|
|
||||||
default:
|
default:
|
||||||
gphttp.BadRequest(w, fmt.Sprintf("invalid what: %s", what))
|
gphttp.BadRequest(w, fmt.Sprintf("invalid what: %s", what))
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,3 @@ func ListRoutes() (map[string]map[string]any, gperr.Error) {
|
||||||
func ListMiddlewareTraces() (middleware.Traces, gperr.Error) {
|
func ListMiddlewareTraces() (middleware.Traces, gperr.Error) {
|
||||||
return List[middleware.Traces](v1.ListMiddlewareTraces)
|
return List[middleware.Traces](v1.ListMiddlewareTraces)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DebugListTasks() (map[string]any, gperr.Error) {
|
|
||||||
return List[map[string]any](v1.ListTasks)
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package task
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -66,12 +65,7 @@ func GracefulShutdown(timeout time.Duration) (err error) {
|
||||||
case <-root.finished:
|
case <-root.finished:
|
||||||
return
|
return
|
||||||
case <-after:
|
case <-after:
|
||||||
b, err := json.Marshal(DebugTaskList())
|
logging.Warn().Msgf("Timeout waiting for %d tasks to finish", allTasks.Size())
|
||||||
if err != nil {
|
|
||||||
logging.Warn().Err(err).Msg("failed to marshal tasks")
|
|
||||||
return context.DeadlineExceeded
|
|
||||||
}
|
|
||||||
logging.Warn().RawJSON("tasks", b).Msgf("Timeout waiting for these %d tasks to finish", allTasks.Size())
|
|
||||||
return context.DeadlineExceeded
|
return context.DeadlineExceeded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue