Skip to content

Wrong data is getting inserted in timeseries #181

Open
@atharva29

Description

@atharva29

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
	}

}

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions