mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 12:06:38 +08:00
fix organize trigger task flow
This commit is contained in:
@@ -159,11 +159,10 @@ func schemaHandler(_ *service.Container) gin.HandlerFunc {
|
||||
// schedulerTriggerHandler is the alternate path for /admin/scheduler/:name/run.
|
||||
func schedulerTriggerHandler(svc *service.Container) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
if err := svc.Scheduler.RunNow(c.Request.Context(), c.Param("name")); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
if !triggerSchedulerJob(c, svc, c.Param("name")) {
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"ok": true})
|
||||
c.JSON(http.StatusAccepted, gin.H{"ok": true, "message": "任务已在后台触发"})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user