Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak http response handling in cronrequest() #95

Closed
tom--pollard opened this issue Apr 26, 2021 · 1 comment · Fixed by #98
Closed

Tweak http response handling in cronrequest() #95

tom--pollard opened this issue Apr 26, 2021 · 1 comment · Fixed by #98

Comments

@tom--pollard
Copy link
Contributor

As ServeHTTP doesn't write a response until all packages from a current 'poll' session have been processed, the current timeout of 10s on the cron GET request times-out waiting for the respons headers.

level=info msg="http request failed: Get \"http://localhost:8080\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

The error is non-fatally handled, as such this isn't a critical issue however it obviously should be handled more gracefully, especially when writing to the log.

@tom--pollard
Copy link
Contributor Author

tom--pollard commented Apr 27, 2021

The default behaviour of having no timeout could be suited to this usecase (as the response holds no substantial value to it), however this is risky when running the requests in goroutines (via the cron package) as they could be left continually waiting to exit if the localhost httpserver is down for whatever reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant