|
|
@ -364,7 +364,7 @@ func WorkerCancel(ctx *context.Context) { |
|
|
|
mq.CancelWorkers(pid) |
|
|
|
mq.CancelWorkers(pid) |
|
|
|
ctx.Flash.Info(ctx.Tr("admin.monitor.queue.pool.cancelling")) |
|
|
|
ctx.Flash.Info(ctx.Tr("admin.monitor.queue.pool.cancelling")) |
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
|
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) |
|
|
|
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
|
|
|
|
// AddWorkers adds workers to a worker group
|
|
|
@ -401,23 +401,23 @@ func AddWorkers(ctx *context.Context) { |
|
|
|
number := ctx.QueryInt("number") |
|
|
|
number := ctx.QueryInt("number") |
|
|
|
if number < 1 { |
|
|
|
if number < 1 { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.addworkers.mustnumbergreaterzero")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
timeout, err := time.ParseDuration(ctx.Query("timeout")) |
|
|
|
timeout, err := time.ParseDuration(ctx.Query("timeout")) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.addworkers.musttimeoutduration")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if _, ok := mq.Managed.(queue.ManagedPool); !ok { |
|
|
|
if _, ok := mq.Managed.(queue.ManagedPool); !ok { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.none")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
mq.AddWorkers(number, timeout) |
|
|
|
mq.AddWorkers(number, timeout) |
|
|
|
ctx.Flash.Success(ctx.Tr("admin.monitor.queue.pool.added")) |
|
|
|
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
|
|
|
|
// 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 { |
|
|
|
if _, ok := mq.Managed.(queue.ManagedPool); !ok { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.pool.none")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -445,7 +445,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
maxNumber, err = strconv.Atoi(maxNumberStr) |
|
|
|
maxNumber, err = strconv.Atoi(maxNumberStr) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.maxnumberworkers.error")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if maxNumber < -1 { |
|
|
|
if maxNumber < -1 { |
|
|
@ -459,7 +459,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
number, err = strconv.Atoi(numberStr) |
|
|
|
number, err = strconv.Atoi(numberStr) |
|
|
|
if err != nil || number < 0 { |
|
|
|
if err != nil || number < 0 { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.numberworkers.error")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -470,7 +470,7 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
timeout, err = time.ParseDuration(timeoutStr) |
|
|
|
timeout, err = time.ParseDuration(timeoutStr) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.Flash.Error(ctx.Tr("admin.monitor.queue.settings.timeout.error")) |
|
|
|
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 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -479,5 +479,5 @@ func SetQueueSettings(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
|
|
mq.SetPoolSettings(maxNumber, number, timeout) |
|
|
|
mq.SetPoolSettings(maxNumber, number, timeout) |
|
|
|
ctx.Flash.Success(ctx.Tr("admin.monitor.queue.settings.changed")) |
|
|
|
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)) |
|
|
|
} |
|
|
|
} |
|
|
|