mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 09:08:06 +08:00
add some
This commit is contained in:
parent
9a192b012f
commit
0f8a77af25
@ -22,10 +22,6 @@ type Log struct {
|
||||
type Frame struct{ p chan *Log }
|
||||
|
||||
func (f *Frame) Begin(m *ice.Message, arg ...string) {
|
||||
f.p = make(chan *Log, ice.MOD_BUFS)
|
||||
ice.Info.Log = func(m *ice.Message, p, l, s string) {
|
||||
f.p <- &Log{c: m.Option(ice.LOG_DEBUG) == ice.TRUE, p: p, l: l, s: s}
|
||||
}
|
||||
}
|
||||
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
if !ice.HasVar() {
|
||||
@ -40,6 +36,10 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
v[FILE] = bufio.NewWriter(f)
|
||||
}
|
||||
})
|
||||
f.p = make(chan *Log, ice.MOD_BUFS)
|
||||
ice.Info.Log = func(m *ice.Message, p, l, s string) {
|
||||
f.p <- &Log{c: m.Option(ice.LOG_DEBUG) == ice.TRUE, p: p, l: l, s: s}
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case l, ok := <-f.p:
|
||||
@ -61,7 +61,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
view := mdb.Confm(m, VIEW, m.Conf(SHOW, kit.Keys(l.l, VIEW)))
|
||||
kit.If(ice.Info.Colors || l.c, func() { bio.WriteString(kit.Format(view[PREFIX])) })
|
||||
defer kit.If(ice.Info.Colors || l.c, func() { bio.WriteString(kit.Format(view[SUFFIX])) })
|
||||
fmt.Fprint(bio, l.l, lex.SP, l.s+kit.Format("what %v", len(f.p)))
|
||||
fmt.Fprint(bio, l.l, lex.SP, l.s)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mdb
|
||||
|
||||
import (
|
||||
"time"
|
||||
"sync"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
@ -21,41 +20,9 @@ func getLock(m *ice.Message, arg ...string) *task.Lock {
|
||||
}
|
||||
func Lock(m *ice.Message, arg ...string) func() {
|
||||
return getLock(m, arg...).Lock()
|
||||
key := kit.Select(m.PrefixKey(), kit.Keys(arg))
|
||||
m.Info("what %v", key)
|
||||
cb := getLock(m, arg...).Lock()
|
||||
m.Info("what %v", key)
|
||||
go func() {
|
||||
time.Sleep(30*time.Second)
|
||||
if cb == nil {
|
||||
return
|
||||
}
|
||||
cb()
|
||||
m.Warn("lock time out %v %v", key, m.FormatStack(1, 100))
|
||||
}()
|
||||
return func() {
|
||||
cb()
|
||||
cb = nil
|
||||
}
|
||||
}
|
||||
func RLock(m *ice.Message, arg ...string) func() {
|
||||
return getLock(m, arg...).RLock()
|
||||
key := kit.Select(m.PrefixKey(), kit.Keys(arg))
|
||||
m.Info("what %v", key)
|
||||
cb := getLock(m, arg...).RLock()
|
||||
m.Info("what %v", key)
|
||||
go func() {
|
||||
time.Sleep(30*time.Second)
|
||||
if cb == nil {
|
||||
return
|
||||
}
|
||||
cb()
|
||||
m.Warn("lock time out %v %v", key, m.FormatStack(1, 100))
|
||||
}()
|
||||
return func() {
|
||||
cb()
|
||||
cb = nil
|
||||
}
|
||||
}
|
||||
|
||||
func ConfigSimple(m *ice.Message, key ...string) (res []string) {
|
||||
|
@ -163,8 +163,6 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
}), SPACE, next) {
|
||||
break
|
||||
}
|
||||
m.Info("what %v", msg.FormatStack(1, 100))
|
||||
m.Info("what %v", msg.FormatChain())
|
||||
if kit.HasPrefixList(msg.Detailv(), "toast") {
|
||||
break
|
||||
}
|
||||
|
@ -149,14 +149,13 @@ func init() {
|
||||
}
|
||||
func spideToken(m *ice.Message, api string, token, expire string, arg ...string) {
|
||||
msg := mdb.HashSelect(m.Spawn(), m.OptionDefault(ACCESS, mdb.Config(m, ACCESS)))
|
||||
m.Info("what token %v %v", msg.Append(expire), msg.Append(token))
|
||||
if msg.Append(token) == "" || m.Time() > msg.Append(expire) {
|
||||
kit.If(api != TICKET_GETTICKET, func() { arg = append(arg, msg.AppendSimple(APPID, SECRET)...) })
|
||||
res := m.Cmd(web.SPIDE, WX, kit.Select(http.MethodGet, http.MethodPost, api == STABLE_TOKEN), api, arg)
|
||||
if m.Warn(!kit.IsIn(res.Append("errcode"), "0", ""), res.Append("errmsg")) {
|
||||
return
|
||||
}
|
||||
m.Info("what res: %v", res.FormatMeta())
|
||||
m.Info("res: %v", res.FormatMeta())
|
||||
mdb.HashModify(m, m.OptionSimple(ACCESS), expire, m.Time(kit.Format("%vs", res.Append(oauth.EXPIRES_IN))), token, res.Append(kit.Select(oauth.ACCESS_TOKEN, TICKET, api == TICKET_GETTICKET)))
|
||||
msg = mdb.HashSelect(m.Spawn(), m.Option(ACCESS))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user