1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-27 01:28:28 +08:00

add call_timeout

Change-Id: I055767b04ab4bb6886149926afe93e2db772e293
This commit is contained in:
shaoying 2019-02-12 11:27:11 +08:00
parent d64b938d61
commit 61e8c06634
2 changed files with 3 additions and 2 deletions

View File

@ -87,6 +87,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
"page_limit": &Config{Name: "page_limit", Value: "10", Help: "列表大小"},
"time_format": &Config{Name: "time_format", Value: "2006-01-02 15:04:05", Help: "时间格式"},
"call_timeout": &Config{Name: "call_timeout", Value: "10s", Help: "回调超时"},
},
Commands: map[string]*Command{
"init": &Command{Name: "init", Help: "启动", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) {

View File

@ -1324,7 +1324,7 @@ func (m *Message) CallBack(sync bool, cb func(msg *Message) (sub *Message), arg
m.Log("sync", m.Format("wait", "result", "append"))
select {
case <-time.After(kit.Duration("30s")):
case <-time.After(kit.Duration(m.Conf("call_timeout"))):
m.Log("sync", m.Format("timeout", "result", "append"))
case <-wait:
}