modelRT/real-time-data/data_polling.go

30 lines
565 B
Go

// Package realtimedata define real time data operation functions
package realtimedata
import (
"context"
"modelRT/config"
"github.com/panjf2000/ants/v2"
)
var AnchorParamsChan chan config.AnchorParamConfig
func init() {
AnchorParamsChan = make(chan config.AnchorParamConfig, 100)
}
// DataPolling perform data polling on dataRT modules based on UUID
func DataPolling(ctx context.Context, pool *ants.PoolWithFunc) {
for {
select {
case <-ctx.Done():
return
case anchorParam := <-AnchorParamsChan:
pool.Invoke(anchorParam)
default:
}
}
}