|
|
|
@ -364,7 +364,7 @@ func WorkerCancel(ctx *context.Context) { |
|
|
|
|
mq.CancelWorkers(pid) |
|
|
|
|
ctx.Flash.Info(ctx.Tr("admin.monitor.queue.pool.cancelling")) |
|
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
|
|
"redirect": setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid), |
|
|
|
|
"redirect": setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10), |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -387,7 +387,7 @@ func Flush(ctx *context.Context) { |
|
|
|
|
log.Error("Flushing failure for %s: Error %v", mq.Name, err) |
|
|
|
|
} |
|
|
|
|
}() |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// AddWorkers adds workers to a worker group
|
|
|
|
@ -401,23 +401,23 @@ func AddWorkers(ctx *context.Context) { |
|
|
|
|
number := ctx.QueryInt("number") |
|
|
|
|
if number < 1 { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.addworkers.mustnumbergreaterzero")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
timeout, err := time.ParseDuration(ctx.Query("timeout")) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.addworkers.musttimeoutduration")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if _, ok := mq.Managed.(queue.ManagedPool); !ok { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.none")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
mq.AddWorkers(number, timeout) |
|
|
|
|
ctx.Flash.Success(ctx.Tr("admin.monitor.queue.pool.added")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SetQueueSettings sets the maximum number of workers and other settings for this queue
|
|
|
|
@ -430,7 +430,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
} |
|
|
|
|
if _, ok := mq.Managed.(queue.ManagedPool); !ok { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.none")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -445,7 +445,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
maxNumber, err = strconv.Atoi(maxNumberStr) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.maxnumberworkers.error")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if maxNumber < -1 { |
|
|
|
@ -459,7 +459,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
number, err = strconv.Atoi(numberStr) |
|
|
|
|
if err != nil || number < 0 { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.numberworkers.error")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -470,7 +470,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
timeout, err = time.ParseDuration(timeoutStr) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.timeout.error")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -479,5 +479,5 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
mq.SetPoolSettings(maxNumber, number, timeout) |
|
|
|
|
ctx.Flash.Success(ctx.Tr("admin.monitor.queue.settings.changed")) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/admin/monitor/queue/%d", qid)) |
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/admin/monitor/queue/" + strconv.FormatInt(qid, 10)) |
|
|
|
|
} |
|
|
|
|