LoopRestTicker

This commit is contained in:
zhangkun 2024-12-10 23:05:44 +08:00
parent 6f3be66181
commit 0a38a98954
2 changed files with 14 additions and 9 deletions

23
main.go
View File

@ -86,6 +86,18 @@ func RestTicker(cr *core.Core, dura time.Duration) {
} }
} }
func LoopRestTicker(cr *core.Core) {
per1 := 1 * time.Minute
RestTicker(cr, per1)
limiter := time.Tick(per1)
for {
<-limiter
go func() {
RestTicker(cr, per1)
}()
}
}
// 统一受理发起rest请求的请求 // 统一受理发起rest请求的请求
func LoopSaveCandle(cr *core.Core) { func LoopSaveCandle(cr *core.Core) {
for { for {
@ -185,15 +197,8 @@ func main() {
cr.ShowSysTime() cr.ShowSysTime()
// 从rest接口获取的ticker记录种的交量计入排行榜指定周期刷新一次 // 从rest接口获取的ticker记录种的交量计入排行榜指定周期刷新一次
go func() { go func() {
per1 := 1 * time.Minute fmt.Println("LoopRestTicker")
RestTicker(&cr, per1) LoopRestTicker(&cr)
limiter := time.Tick(per1)
for {
<-limiter
go func() {
RestTicker(&cr, per1)
}()
}
}() }()
// 全员15m candle // 全员15m candle
go func() { go func() {

BIN
texus

Binary file not shown.