fix: websocket timeout reached (fixes #524)

This commit is contained in:
Julien Neuhart
2022-10-16 12:34:22 +02:00
parent 8d8f0b55ea
commit b73207f29a
2 changed files with 85 additions and 21 deletions

View File

@@ -420,6 +420,14 @@ func (mod Chromium) PDF(ctx context.Context, logger *zap.Logger, URL, outputPath
args = append(args, chromedp.UserAgent(options.UserAgent))
}
// See https://github.com/gotenberg/gotenberg/issues/524.
deadline, ok := ctx.Deadline()
if !ok {
return errors.New("context has no deadline")
}
args = append(args, chromedp.WSURLReadTimeout(time.Until(deadline)))
allocatorCtx, cancel := chromedp.NewExecAllocator(ctx, args...)
defer cancel()