1
0
forked from x/icebergs

opt timeout

This commit is contained in:
shaoying 2020-06-03 22:25:21 +08:00
parent 7dc0108151
commit 436e25f546
2 changed files with 4 additions and 3 deletions

View File

@ -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{

View File

@ -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)
})