🎨 增加最大处理时间

This commit is contained in:
源文雨
2022-10-29 11:25:50 +08:00
parent 3c03a308b3
commit 01361781c8
4 changed files with 30 additions and 26 deletions

18
main.go
View File

@@ -199,8 +199,9 @@ func init() {
prefix := flag.String("p", "/", "Set command prefix.")
runcfg := flag.String("c", "", "Run from config file.")
save := flag.String("s", "", "Save default config to file and exit.")
late := flag.Uint("l", 1000, "Response latency.")
late := flag.Uint("l", 1000, "Response latency (ms).")
rsz := flag.Uint("r", 4096, "Receiving buffer ring size.")
maxpt := flag.Uint("x", 4, "Max process time (min).")
flag.Parse()
@@ -250,12 +251,13 @@ func init() {
config.W = []*driver.WSClient{driver.NewWebSocketClient(*url, *token)}
config.Z = zero.Config{
NickName: append([]string{*adana}, "ATRI", "atri", "亚托莉", "アトリ"),
CommandPrefix: *prefix,
SuperUsers: sus,
RingLen: *rsz,
Latency: time.Duration(*late) * time.Millisecond,
Driver: []zero.Driver{config.W[0]},
NickName: append([]string{*adana}, "ATRI", "atri", "亚托莉", "アトリ"),
CommandPrefix: *prefix,
SuperUsers: sus,
RingLen: *rsz,
Latency: time.Duration(*late) * time.Millisecond,
MaxProcessTime: time.Duration(*maxpt) * time.Minute,
Driver: []zero.Driver{config.W[0]},
}
if *save != "" {
@@ -284,5 +286,5 @@ func main() {
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(kanban.Kanban()))
})
zero.RunAndBlock(config.Z, process.GlobalInitMutex.Unlock)
zero.RunAndBlock(&config.Z, process.GlobalInitMutex.Unlock)
}