2025-09-19 16:17:46 +08:00
|
|
|
package data
|
2025-10-23 18:02:29 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2025-12-05 17:54:25 +08:00
|
|
|
"datart/data/influx"
|
|
|
|
|
"datart/data/mongo"
|
2025-11-06 21:09:50 +08:00
|
|
|
"datart/data/postgres"
|
2025-12-05 17:54:25 +08:00
|
|
|
"datart/data/rabbit"
|
|
|
|
|
"datart/data/redis"
|
2025-10-23 18:02:29 +08:00
|
|
|
)
|
|
|
|
|
|
2025-12-05 17:54:25 +08:00
|
|
|
type Processes struct {
|
2025-10-23 18:02:29 +08:00
|
|
|
cancel context.CancelFunc
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-05 17:54:25 +08:00
|
|
|
func NewProcesses() *Processes {
|
|
|
|
|
return new(Processes)
|
2025-10-23 18:02:29 +08:00
|
|
|
}
|
|
|
|
|
|
2025-12-05 17:54:25 +08:00
|
|
|
func (p *Processes) StartDataProcessing() {
|
2025-10-23 18:02:29 +08:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
|
p.cancel = cancel
|
2025-12-05 17:54:25 +08:00
|
|
|
|
2025-11-06 21:09:50 +08:00
|
|
|
postgres.GenSSU2ChannelSizes(ctx, 500)
|
2025-12-05 17:54:25 +08:00
|
|
|
|
2025-10-23 18:02:29 +08:00
|
|
|
updatingRedisPhasor(ctx)
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-05 17:54:25 +08:00
|
|
|
func (p *Processes) Cancel(ctx context.Context) {
|
2025-10-23 18:02:29 +08:00
|
|
|
p.cancel()
|
2025-12-05 17:54:25 +08:00
|
|
|
|
|
|
|
|
eventNotifyPublisher.Close(ctx)
|
|
|
|
|
|
|
|
|
|
influx.CloseDefault()
|
|
|
|
|
mongo.CloseDefault(ctx)
|
|
|
|
|
postgres.CloseDefault()
|
|
|
|
|
rabbit.CloseDefault(ctx)
|
|
|
|
|
redis.CloseDefault()
|
2025-10-23 18:02:29 +08:00
|
|
|
}
|