Add 60s timeout
This commit is contained in:
parent
6926e9f3e4
commit
5cedea4836
4
main.go
4
main.go
|
@ -18,6 +18,7 @@ import (
|
||||||
"git.sr.ht/~adnano/go-gemini/tofu"
|
"git.sr.ht/~adnano/go-gemini/tofu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const TIMEOUT_NS time.Duration = time.Duration(60_000_000_000)
|
||||||
var (
|
var (
|
||||||
hosts tofu.KnownHosts
|
hosts tofu.KnownHosts
|
||||||
hostsfile *tofu.HostWriter
|
hostsfile *tofu.HostWriter
|
||||||
|
@ -149,7 +150,8 @@ func main() {
|
||||||
client := gemini.Client{
|
client := gemini.Client{
|
||||||
TrustCertificate: trustCertificate,
|
TrustCertificate: trustCertificate,
|
||||||
}
|
}
|
||||||
ctx := context.Background()
|
ctx, cancel := context.WithTimeout(context.Background(), TIMEOUT_NS)
|
||||||
|
defer cancel()
|
||||||
resp, req, err := do(client, ctx, req, nil)
|
resp, req, err := do(client, ctx, req, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue