RedisTimeSeries / redistimeseries-go

golang client lib for RedisTimeSeries
https://redistimeseries.io
Apache License 2.0
64 stars 18 forks source link

Wrong data is getting inserted in timeseries #181

Open atharva29 opened 5 months ago

atharva29 commented 5 months ago

I am pushing some data in redistimeseries. Before pushing i am logging the data. After that through Redis cli if i check the data, then it shows some values as random and some actual values that i am pushing. Following is my code. I have also created a compaction buckets of 1 min O H L C and 5 min OHLC (OPEN HIGH LOW CLOSE). Some random samples are also getting inserted in source bucket i.e. ts_25

`func (r *RedisClient) saveChartToRedis() { defer logger.NewLogger.Info("closing saveChartToRedis") for feed := range r.chartChan { keyname := fmt.Sprintf("ts_%d", feed.ScripCode)

    timeFormat := "02/01/2006 15:04:05"
    t, err := time.Parse(timeFormat, feed.LastUpdatedTime)
    if err != nil {
        logger.NewLogger.Error("CHART TIME ERROR: ", err.Error())
        continue
    }
    fmt.Println("Pushing data to ", feed.ExchangeCode, 25, keyname, float64(feed.Ltp), "@", feed.LastUpdatedTime)
    if _, err := r.ts.AddWithOptions(keyname, t.Unix(), float64(feed.Ltp), redistimeseries.CreateOptions{DuplicatePolicy: redistimeseries.FirstDuplicatePolicy}); err != nil {
        logger.NewLogger.Error("CHART ERROR: ", err.Error())
        continue
    }

}

}`

LiorKogan commented 5 months ago

redistimeseries-go is now deprecated. Please witch to go-redis version 9.2+ with support for RTS.