context timeout for postmsg
Ted Unangst tedu@tedunangst.com
Sat, 09 May 2020 19:25:25 -0400
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -17,6 +17,7 @@ package main
import ( "bytes" + "context" "database/sql" "errors" "fmt"@@ -69,6 +70,9 @@ }
req.Header.Set("User-Agent", "honksnonk/5.0; "+serverName) req.Header.Set("Content-Type", theonetruename) httpsig.SignRequest(keyname, key, req, msg) + ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Minute) + defer cancel() + req = req.WithContext(ctx) resp, err := client.Do(req) if err != nil { return err