fix(nimbus): Update nimbus timeout to 500ms

This commit is contained in:
Vijay Budhram
2025-12-10 16:16:09 -05:00
parent 6157c2eb0d
commit 5bb1c7c8aa
2 changed files with 19 additions and 12 deletions

View File

@@ -718,8 +718,8 @@ const conf = (module.exports = convict({
format: String,
},
timeout: {
default: 200,
doc: 'Amount of time in milliseconds to wait for a response from cirrus',
default: 400,
doc: 'Amount of time in milliseconds to wait for a response from cirrus.',
env: 'NIMBUS_CIRRUS_TIMEOUT',
format: Number,
},

View File

@@ -60,22 +60,29 @@ module.exports = function (config, statsd) {
statsd.increment('cirrus.experiment-fetch-success');
}
} catch (err) {
Sentry.captureException(err, {
tags: {
source: 'nimbus-experiments',
},
});
const isTimeout = err.name === 'AbortError' || err.name === 'TimeoutError';
if (statsd) {
statsd.increment('cirrus.experiment-fetch-error');
if (isTimeout) {
statsd.increment('cirrus.experiment-fetch-timeout');
}
}
if (!isTimeout) {
Sentry.captureException(err, {
tags: {
source: 'nimbus-experiments',
}
});
}
// Return a 'service unavailable' error. We essentially failed
// to communicate with the cirrus server, so experiments are
// now unavailable...
res.status(503);
res.end();
// Record failure
if (statsd) {
statsd.increment('cirrus.experiment-fetch-error');
}
} finally {
clearTimeout(timeoutId);