parser/main.go

49 lines
715 B
Go

package main
import (
"git.fuyu.moe/5GPowerQuality/parser/data"
"git.fuyu.moe/5GPowerQuality/parser/envitron"
"git.fuyu.moe/5GPowerQuality/parser/fortop"
"git.fuyu.moe/5GPowerQuality/parser/fortoprt"
"git.fuyu.moe/Fuyu/flog"
)
func main() {
defer recoverFunc()
setLogger()
flog.Info(`Starting`)
catchSignals()
data.InitDB()
go fetchFortopData()
go fetchFortopRealtimeData()
envitron.ReceiveData()
}
func recoverFunc() {
v := recover()
if v != nil {
flog.Critical(`panic: `, v)
}
}
func fetchFortopData() {
for {
func() {
defer recoverFunc()
fortop.FetchData()
}()
}
}
func fetchFortopRealtimeData() {
for {
func() {
defer recoverFunc()
fortoprt.FetchData()
}()
}
}