chore(api): remove debug task list endpoint

This commit is contained in:
yusing 2025-04-13 05:56:25 +08:00
parent 0d859cc36f
commit 2b44ac5bcb
3 changed files with 1 additions and 15 deletions

View file

@ -13,7 +13,6 @@ import (
"github.com/yusing/go-proxy/internal/net/gphttp/middleware"
"github.com/yusing/go-proxy/internal/route/routes/routequery"
route "github.com/yusing/go-proxy/internal/route/types"
"github.com/yusing/go-proxy/internal/task"
"github.com/yusing/go-proxy/internal/utils"
)
@ -28,7 +27,6 @@ const (
ListRouteProviders = "route_providers"
ListHomepageCategories = "homepage_categories"
ListIcons = "icons"
ListTasks = "tasks"
)
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{}
}
gphttp.RespondJSON(w, r, icons)
case ListTasks:
gphttp.RespondJSON(w, r, task.DebugTaskList())
default:
gphttp.BadRequest(w, fmt.Sprintf("invalid what: %s", what))
}

View file

@ -58,7 +58,3 @@ func ListRoutes() (map[string]map[string]any, gperr.Error) {
func ListMiddlewareTraces() (middleware.Traces, gperr.Error) {
return List[middleware.Traces](v1.ListMiddlewareTraces)
}
func DebugListTasks() (map[string]any, gperr.Error) {
return List[map[string]any](v1.ListTasks)
}

View file

@ -2,7 +2,6 @@ package task
import (
"context"
"encoding/json"
"errors"
"os"
"os/signal"
@ -66,12 +65,7 @@ func GracefulShutdown(timeout time.Duration) (err error) {
case <-root.finished:
return
case <-after:
b, err := json.Marshal(DebugTaskList())
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())
logging.Warn().Msgf("Timeout waiting for %d tasks to finish", allTasks.Size())
return context.DeadlineExceeded
}
}