43 lines
729 B
Go
43 lines
729 B
Go
package data
|
|
|
|
import (
|
|
"context"
|
|
"datart/data/influx"
|
|
"datart/data/mongo"
|
|
"datart/data/postgres"
|
|
"datart/data/rabbit"
|
|
"datart/data/redis"
|
|
"datart/log"
|
|
)
|
|
|
|
type Processes struct {
|
|
cancel context.CancelFunc
|
|
}
|
|
|
|
func NewProcesses() *Processes {
|
|
return new(Processes)
|
|
}
|
|
|
|
func (p *Processes) StartDataProcessing() {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
p.cancel = cancel
|
|
|
|
if err := postgres.GenSSU2ChannelSizes(ctx, 500); err != nil {
|
|
log.Error(err)
|
|
}
|
|
|
|
updatingRedisPhasor(ctx)
|
|
}
|
|
|
|
func (p *Processes) Cancel(ctx context.Context) {
|
|
p.cancel()
|
|
|
|
eventNotifyPublisher.Close(ctx)
|
|
|
|
influx.CloseDefault()
|
|
mongo.CloseDefault(ctx)
|
|
postgres.CloseDefault()
|
|
rabbit.CloseDefault(ctx)
|
|
redis.CloseDefault()
|
|
}
|