From cea412f2ba721c123775fbe9bc1355c62e9b7b2b Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 3 Mar 2017 15:57:24 -0600 Subject: [PATCH] Fix chat example --- examples/chat/main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/chat/main.go b/examples/chat/main.go index ad8d56db..69ef456b 100644 --- a/examples/chat/main.go +++ b/examples/chat/main.go @@ -2,10 +2,11 @@ package main import ( "bufio" + "context" "fmt" - "github.com/jackc/pgx" "os" - "time" + + "github.com/jackc/pgx" ) var pool *pgx.ConnPool @@ -58,10 +59,7 @@ func listen() { conn.Listen("chat") for { - notification, err := conn.WaitForNotification(time.Second) - if err == pgx.ErrNotificationTimeout { - continue - } + notification, err := conn.WaitForNotification(context.Background()) if err != nil { fmt.Fprintln(os.Stderr, "Error waiting for notification:", err) os.Exit(1)