diff options
author | Teddy Wing | 2023-11-19 12:39:21 +0100 |
---|---|---|
committer | Teddy Wing | 2023-11-19 12:39:21 +0100 |
commit | ba83d5e8389638b4cbdbdbd024a9e294a422491d (patch) | |
tree | 1d157002211baccacef8569efe8a2adb69008b09 /internal | |
parent | 1429de3e6aae2652940e6c554b792227a04eff09 (diff) | |
download | swextreload-ba83d5e8389638b4cbdbdbd024a9e294a422491d.tar.bz2 |
swextreload: Timeout after five seconds
If there's a hangup in the DevTools Protocol communication, just exit
like we did in Extreload.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/swextreload.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/swextreload.go b/internal/swextreload.go index 24b5bd7..1932b32 100644 --- a/internal/swextreload.go +++ b/internal/swextreload.go @@ -28,9 +28,13 @@ func Reload( ) error { var err error - allocatorContext, cancel := chromedp.NewRemoteAllocator( - context.Background(), - url, + allocatorContext, _ := chromedp.NewRemoteAllocator( + context.Background(), + url, + ) + allocatorContext, cancel := context.WithTimeout( + allocatorContext, + 5*time.Second, ) defer cancel() |