forked from x/icebergs
opt some
This commit is contained in:
parent
2473f3cf3e
commit
82f59f190b
@ -15,15 +15,15 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) ice.Server {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
func (f *Frame) Start(m *ice.Message, arg ...string) bool {
|
func (f *Frame) Start(m *ice.Message, arg ...string) bool {
|
||||||
t := kit.Duration(m.Conf(TIMER, kit.Keym(TICK)))
|
t := kit.Duration(mdb.Conf(m, TIMER, kit.Keym(TICK)))
|
||||||
enable := m.Conf(TIMER, kit.Keym("enable")) == ice.TRUE
|
enable := mdb.Conf(m, TIMER, kit.Keym("enable")) == ice.TRUE
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-time.Tick(t):
|
case <-time.Tick(t):
|
||||||
if enable {
|
if enable {
|
||||||
m.Cmd(TIMER, HAPPEN)
|
m.Cmd(TIMER, HAPPEN)
|
||||||
}
|
}
|
||||||
case s, ok := <-f.s:
|
case s, ok := <-f.s:
|
||||||
if !ok {
|
if !ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -26,13 +26,13 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) ice.Server {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
func (f *Frame) Start(m *ice.Message, arg ...string) bool {
|
func (f *Frame) Start(m *ice.Message, arg ...string) bool {
|
||||||
|
m.Option("_lock", m.PrefixKey())
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case l, ok := <-f.p:
|
case l, ok := <-f.p:
|
||||||
if !ok {
|
if !ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
continue
|
|
||||||
for _, file := range []string{m.Conf(SHOW, kit.Keys(l.l, FILE)), BENCH} {
|
for _, file := range []string{m.Conf(SHOW, kit.Keys(l.l, FILE)), BENCH} {
|
||||||
if file == "" {
|
if file == "" {
|
||||||
continue
|
continue
|
||||||
|
@ -167,7 +167,7 @@ func StatusHashAction(arg ...Any) ice.Actions {
|
|||||||
}, HashAction(arg...))
|
}, HashAction(arg...))
|
||||||
}
|
}
|
||||||
func ClearHashOnExitAction() ice.Actions {
|
func ClearHashOnExitAction() ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { m.Conf("", HASH, "") }}})
|
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func HashKey(m *ice.Message) string {
|
func HashKey(m *ice.Message) string {
|
||||||
@ -235,7 +235,7 @@ func HashSelects(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
return HashSelect(m, arg...)
|
return HashSelect(m, arg...)
|
||||||
}
|
}
|
||||||
func HashSelectValue(m *ice.Message, cb Any) *ice.Message {
|
func HashSelectValue(m *ice.Message, cb Any) *ice.Message {
|
||||||
m.OptionFields(m.Config(FIELD))
|
m.OptionFields(Config(m, FIELD))
|
||||||
defer RLock(m, m.PrefixKey(), "")()
|
defer RLock(m, m.PrefixKey(), "")()
|
||||||
Richs(m, m.PrefixKey(), nil, FOREACH, func(key string, value Map) { _mdb_select(m, cb, key, value, nil, nil) })
|
Richs(m, m.PrefixKey(), nil, FOREACH, func(key string, value Map) { _mdb_select(m, cb, key, value, nil, nil) })
|
||||||
return m
|
return m
|
||||||
|
@ -37,6 +37,6 @@ func RenderAction(args ...ice.Any) ice.Actions {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { m.Conf("", HASH, "") }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
2
type.go
2
type.go
@ -527,7 +527,7 @@ func (m *Message) Confi(key string, sub string) int {
|
|||||||
}
|
}
|
||||||
func (m *Message) Confv(arg ...Any) (val Any) {
|
func (m *Message) Confv(arg ...Any) (val Any) {
|
||||||
if m.Spawn().Warn(Info.Important && m.Option("_lock") == "") {
|
if m.Spawn().Warn(Info.Important && m.Option("_lock") == "") {
|
||||||
m.Debug("what lock %s %s", m.PrefixKey(), m.FormatStack(1, 100))
|
m.Warn(true, "what unsafe lock", m.PrefixKey(), m.FormatStack(1, 100))
|
||||||
}
|
}
|
||||||
run := func(conf *Config) {
|
run := func(conf *Config) {
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user