I have a go server with redigo and I have this function to get data from redis :
func findCompetition(conn redis.Conn, username string) competition{
conn.Send("KEYS", "*")
conn.Flush()
re, erre := conn.Receive()
keys, err := redis.Strings(re, erre)
if err != nil {
log.Print(re)
log.Print(err)
return competition{Username:"null"}
}
for _, key := range keys {
comp := getCompetition(conn, key)
if comp.Competitor == username &&
time.Now().Sub(comp.Time_asked).Minutes() < 2.0 {
return comp
}
}
return competition{Username:"null"}
}
when I send request by browser like : http://localhost:4500/find_competition/aicam It's ok but when my angular project send request every 1.5sec after some seconds log.Print(err) prints error below :
read tcp 127.0.0.1:35874->127.0.0.1:6379: use of closed network connection
I tried all of the solutions like : stackoverflow github and port 35874 changes sometimes