Files
esdi/providers/iracing/utils.go
T
esilva dbd4086bf9 Provider loop discovery almost finished
Provider lookup will lookup on startup, do the healthcheck until the
stream starts and also restart on stream closure or provider stall
2026-09-17 23:01:50 +01:00

34 lines
655 B
Go

package iracing
import (
"log/slog"
"time"
"github.com/ESilva15/goirsdk"
eventutils "github.com/ESilva15/goirsdk/eventutils"
)
func IsRunning() bool {
irUtils, err := eventutils.Init()
if err != nil {
// we need error validation or something here
return false
}
defer irUtils.Close()
if err := irUtils.OpenEvent(goirsdk.IRSDK_DATAVALIDEVENTNAME); err != nil {
// we need error validation or something here
return false
}
// We now check for some consecutive data events
for range 3 {
if !irUtils.CheckValidDataEvent(1 * time.Second) {
slog.Debug("timed out waiting for DataValidEvent")
return false
}
}
return true
}