2
0

Fix chat example

This commit is contained in:
Jack Christensen
2017-03-03 15:57:24 -06:00
parent e53f739cbd
commit cea412f2ba
+4 -6
View File
@@ -2,10 +2,11 @@ package main
import ( import (
"bufio" "bufio"
"context"
"fmt" "fmt"
"github.com/jackc/pgx"
"os" "os"
"time"
"github.com/jackc/pgx"
) )
var pool *pgx.ConnPool var pool *pgx.ConnPool
@@ -58,10 +59,7 @@ func listen() {
conn.Listen("chat") conn.Listen("chat")
for { for {
notification, err := conn.WaitForNotification(time.Second) notification, err := conn.WaitForNotification(context.Background())
if err == pgx.ErrNotificationTimeout {
continue
}
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, "Error waiting for notification:", err) fmt.Fprintln(os.Stderr, "Error waiting for notification:", err)
os.Exit(1) os.Exit(1)