I create code like this and work together
ctl.RedisCount(nil).HIncrBy(test_count, strconv.Itoa(int(xxxID)), 1)
ctl.RedisCount(nil).HGetAll
ctl.RedisCountView(nil).HDel(test_count, strconv.Itoa(int(xxxID)), 1)
====================================================
this function have a data race condition because high concurrency
some time I get value from HGetAll = 1321 but in fact should get 15
some time everything look like normal such as expect HGetAll = 5 I get 5
Has anyone ever encountered a problem like this?
if I use this https://github.com/go-redsync/redsync I will solve this?
I use “github.com/go-redis/redis/v7”
thank you for your help
I expect solution for fix this
Insomnia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.