Go: add context, part4 (#17381)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-26 18:31:56 +08:00
committed by GitHub
parent d2a769c532
commit 53e83dcadf
23 changed files with 370 additions and 315 deletions

View File

@@ -1019,7 +1019,8 @@ func (h *Handler) RemoveIngestionTasks(c *gin.Context) {
}
if req.Email == nil && req.Status == nil {
tasks, err := h.service.RemoveIngestionTasks(req.Tasks)
ctx := c.Request.Context()
tasks, err := h.service.RemoveIngestionTasks(ctx, req.Tasks)
if err != nil {
common.ErrorWithCode(c, handler.IngestionTaskErrorCode(err), err.Error())
return
@@ -1050,7 +1051,8 @@ func (h *Handler) StopIngestionTasks(c *gin.Context) {
}
if req.Email == nil && req.Status == nil {
tasks, err := h.service.StopIngestionTasks(req.Tasks)
ctx := c.Request.Context()
tasks, err := h.service.StopIngestionTasks(ctx, req.Tasks)
if err != nil {
common.ErrorWithCode(c, handler.IngestionTaskErrorCode(err), err.Error())
return
@@ -1085,7 +1087,8 @@ func (h *Handler) ListIngestionTasks(c *gin.Context) {
var tasks []map[string]interface{}
var req ListIngestionTasksRequest
if err = c.ShouldBindJSON(&req); err != nil {
tasks, err = h.service.ListIngestionTasks()
ctx := c.Request.Context()
tasks, err = h.service.ListIngestionTasks(ctx)
} else {
tasks, err = h.service.ListIngestionTasksByCondition(req.Email, req.Status)
}