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:
parent
d64b938d61
commit
61e8c06634
@ -86,7 +86,8 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
"page_offset": &Config{Name: "page_offset", Value: "0", Help: "列表偏移"},
|
"page_offset": &Config{Name: "page_offset", Value: "0", Help: "列表偏移"},
|
||||||
"page_limit": &Config{Name: "page_limit", Value: "10", Help: "列表大小"},
|
"page_limit": &Config{Name: "page_limit", Value: "10", Help: "列表大小"},
|
||||||
|
|
||||||
"time_format": &Config{Name: "time_format", Value: "2006-01-02 15:04:05", 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{
|
Commands: map[string]*Command{
|
||||||
"init": &Command{Name: "init", Help: "启动", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) {
|
"init": &Command{Name: "init", Help: "启动", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) {
|
||||||
|
@ -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"))
|
m.Log("sync", m.Format("wait", "result", "append"))
|
||||||
select {
|
select {
|
||||||
case <-time.After(kit.Duration("30s")):
|
case <-time.After(kit.Duration(m.Conf("call_timeout"))):
|
||||||
m.Log("sync", m.Format("timeout", "result", "append"))
|
m.Log("sync", m.Format("timeout", "result", "append"))
|
||||||
case <-wait:
|
case <-wait:
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user