this is code
func main() {
...
pool := createPool(*redis_server, *redis_pass)
defer pool.Close()
c := pool.Get()
var i int64
st := tickSec()
for i = 0; i < *total; i++ {
r := time.Now().Unix() - rand.Int63n(60*60*24*31*12)
score, _ := strconv.Atoi(time.Unix(r, 0).Format("2006010215"))
id := utee.PlainMd5(uuid.NewUUID().String())
c.Send("ZADD", "app_a_5512", score, id)
if i%10000 == 0 {
c.Flush()
log.Println("current sync to redis", i)
}
}
//c.Flush()
c.Close()
...
}
if i use c.Close(),the total set 100000,the real sortedset count 100000. but if i use c.Flush(),the total also set 100000, the real sortedset count less than 100000(96932);if i use time.Sleep() in the end of the main func,the total is 100000 too.
when main func exit,the flush func is not complete?and why? thank you!