dataRT/data/data.go

41 lines
671 B
Go
Raw Normal View History

2025-09-19 16:17:46 +08:00
package data
2025-10-23 18:02:29 +08:00
import (
"context"
2026-03-06 17:17:39 +08:00
"datart/data/cl104"
2025-10-23 18:02:29 +08:00
"datart/data/influx"
2025-11-06 21:09:50 +08:00
"datart/data/postgres"
2025-11-20 20:58:51 +08:00
"datart/data/redis"
"datart/log"
2025-10-23 18:02:29 +08:00
)
2025-11-20 20:58:51 +08:00
type Processes struct {
2025-10-23 18:02:29 +08:00
cancel context.CancelFunc
}
2025-11-20 20:58:51 +08:00
func NewProcesses() *Processes {
return new(Processes)
2025-10-23 18:02:29 +08:00
}
2025-11-20 20:58:51 +08:00
func (p *Processes) StartDataProcessing() {
2025-10-23 18:02:29 +08:00
ctx, cancel := context.WithCancel(context.Background())
p.cancel = cancel
2025-11-20 20:58:51 +08:00
if err := postgres.GenSSU2ChannelSizes(ctx, 500); err != nil {
log.Error(err)
}
2025-10-23 18:02:29 +08:00
2025-11-20 20:58:51 +08:00
updatingRedisPhasor(ctx)
2026-03-20 17:37:39 +08:00
updatingRedisCL104(ctx)
2026-03-06 17:17:39 +08:00
2026-04-16 16:45:31 +08:00
cl104.ConnectCLs(ctx)
2025-10-23 18:02:29 +08:00
}
2025-11-20 20:58:51 +08:00
func (p *Processes) Cancel(ctx context.Context) {
p.cancel()
2025-10-23 18:02:29 +08:00
2025-11-20 20:58:51 +08:00
influx.CloseDefault()
postgres.CloseDefault()
redis.CloseDefault()
2025-10-23 18:02:29 +08:00
}