1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-03-22 18:12:52 +08:00
parent 2473f3cf3e
commit 82f59f190b
5 changed files with 9 additions and 9 deletions

View File

@ -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 &lt;-time.Tick(t):
if enable { if enable {
m.Cmd(TIMER, HAPPEN) m.Cmd(TIMER, HAPPEN)
} }
case s, ok := <-f.s: case s, ok := &lt;-f.s:
if !ok { if !ok {
return true return true
} }

View File

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

View File

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

View File

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

View File

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