I'm new to Go. Say I have a server listening to HTTP request, and at the same time I need to check Redis notification so I can update data. Below is an example:
func checkExpire() {
for {
switch msg := pubSubConn.Receive().(type) {
case redis.Message:
...
}
}
server.ListenAndServe()
Does simply putting checkExpire
into a goroutine a good solution?
go func() {
for {
switch msg := pubSubConn.Receive().(type) {
case redis.Message:
...
}
}()