Skip to content
Snippets Groups Projects
Commit c9bfccfd authored by Rhys Arkins's avatar Rhys Arkins
Browse files

feat(host-rules): configurable timeout

Closes #3640
parent bc076c37
No related merge requests found
......@@ -1703,6 +1703,11 @@ const options = [
name: 'hostRules',
description: 'Host rules/configuration including credentials',
type: 'array',
default: [
{
timeout: 60000,
},
],
stage: 'repository',
cli: true,
mergeable: true,
......@@ -1744,6 +1749,15 @@ const options = [
cli: false,
env: false,
},
{
name: 'timeout',
description: 'timeout (in milliseconds) for queries to external endpoints',
type: 'integer',
stage: 'repository',
parent: 'hostRules',
cli: false,
env: false,
},
{
name: 'prBodyDefinitions',
description: 'Table column definitions for use in PR tables',
......
......@@ -5,16 +5,13 @@ const hostRules = require('../host-rules');
// istanbul ignore next
module.exports = got.create({
options: {
// TODO: Move to configurable host rules
timeout: 60 * 1000,
},
options: {},
handler: (options, next) => {
const { hostType, ...opts } = options;
if (!options.hostname) {
return next(opts);
}
const { username = '', password, token } = hostRules.find({
const { username = '', password, token, timeout } = hostRules.find({
hostType,
url: options.href,
});
......@@ -27,7 +24,9 @@ module.exports = got.create({
logger.debug('Applying Bearer authentication for host ' + opts.hostname);
opts.token = token;
}
// TODO: apply other options/headers
if (timeout) {
opts.timeout = timeout;
}
return next(opts);
},
});
......@@ -1172,6 +1172,11 @@
"hostRules": {
"description": "Host rules/configuration including credentials",
"type": "array",
"default": [
{
"timeout": 60000
}
],
"items": {
"allOf": [
{
......@@ -1192,6 +1197,10 @@
"baseUrl": {
"description": "baseUrl for a host rule. e.g. \"https://api.github.com/\"",
"type": "string"
},
"timeout": {
"description": "timeout (in milliseconds) for queries to external endpoints",
"type": "integer"
}
}
}
......
......@@ -347,6 +347,16 @@ Renovate will match against all baseUrls. It does not do a "longest match" algor
### hostType
### timeout
Use this figure to adjust the timeout for queries. The default is 60s, which is quite high. To adjust it down to 10s for all queries, do this:
```json
"hostRules": [{
"timeout": 10000,
}]
```
## ignoreDeprecated
By default, Renovate won't update any packages to deprecated versions unless the package version was _already_ deprecated. The goal of this is to make sure you don't upgrade from a non-deprecated version to a deprecated one just because it's higher than the current version. If for some reason you wish to _force_ deprecated updates on Renovate, you can set `ignoreDeprecated` to `false`, but this is not recommended for most situations.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment