From 436e25f5461da788224f1117daa83e5607605e7e Mon Sep 17 00:00:00 2001 From: shaoying Date: Wed, 3 Jun 2020 22:25:21 +0800 Subject: [PATCH] opt timeout --- base/web/space.go | 2 +- exec.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/base/web/space.go b/base/web/space.go index 39d838a1..e5d71309 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -118,7 +118,7 @@ func init() { ice.WEB_SPACE: {Name: "space", Help: "空间站", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME, "redial.a", 3000, "redial.b", 1000, "redial.c", 1000, "buffer.r", 4096, "buffer.w", 4096, - "timeout.c", "30s", + "timeout.c", "180s", )}, }, Commands: map[string]*ice.Command{ diff --git a/exec.go b/exec.go index de898ceb..7256155d 100644 --- a/exec.go +++ b/exec.go @@ -81,8 +81,9 @@ func (m *Message) Done() bool { } func (m *Message) Call(sync bool, cb func(*Message) *Message) *Message { wait := make(chan bool, 2) - t := time.AfterFunc(kit.Duration(kit.Select("10s", m.Option("timeout"))), func() { - m.Warn(true, "timeout %v", m.Detailv()) + p := kit.Select("10s", m.Option("timeout")) + t := time.AfterFunc(kit.Duration(p), func() { + m.Warn(true, "%s timeout %v", p, m.Detailv()) wait <- false m.Back(nil) })