-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to avoid intermittent errors when checking links (#86)
* Avoid using the default HTTP transport It's a global tranpsort and could be changed by any dependency. Signed-off-by: Douglas Camata <[email protected]> * Add sensible timeouts and reduce parallelism This is an effort to avoid random errors when checking a bunch of links across many files: - Considering this is a tool often ran in resource constrained environments, like Github Actions, the HTTP client timeout was bumped to 30 seconds. - Colly was configured with a depth of 1, to avoid crawling too much information from the websites - The parallelism configuration of `colly` has been brought down from 100 to 10. This setting means that at most 10 requests will be sent in parallel for the same matching domain. This way we are more friendly to the servers and hopefully they will be happier with us too, returning more responses with 200 status code. - Added a random delay of up to 1 second to create new requests to matching domains, again to be more friendly with the servers, etc, etc. Signed-off-by: Douglas Camata <[email protected]> * Move away from `Dial` (it's deprecated) `DialContext` is the new way to go. Signed-off-by: Douglas Camata <[email protected]> * Remove maxDepth and default timeout of 30s Signed-off-by: Douglas Camata <[email protected]> * Make a few HTTP options configurable These options are: * Colly's HTTP parallelism * Colly's random delay between HTTP requests * HTTP transport's max connections per host * Fix MaxConnsPerHost usage Signed-off-by: Douglas Camata <[email protected]> * Update example validate configuration Signed-off-by: Douglas Camata <[email protected]> * Add documentation about default config values Signed-off-by: Douglas Camata <[email protected]> * Handle parallelism config more safely Signed-off-by: Douglas Camata <[email protected]> * Revert editor's autoformat Bad editor! Signed-off-by: Douglas Camata <[email protected]>
- Loading branch information
1 parent
e74bd1d
commit d39d57f
Showing
4 changed files
with
80 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters