diff --git a/src/graphs.js b/src/graphs.js index b32d3a2d2..8bd16bf64 100644 --- a/src/graphs.js +++ b/src/graphs.js @@ -61,7 +61,9 @@ async function getContainerStats(name, fromMinutes, noNullPoints) { noNullPoints: !!noNullPoints }; - const [error, response] = await safe(superagent.get(graphiteUrl).query(query).timeout(30 * 1000).ok(() => true)); + // the retry() is needed because there is a node/fetch bug that a closed socket is reused when making a request to the same endpoint many times + // https://github.com/nodejs/undici/issues/3492 + const [error, response] = await safe(superagent.get(graphiteUrl).query(query).timeout(30 * 1000).retry(3).ok(() => true)); if (error) throw new BoxError(BoxError.NETWORK_ERROR, error); if (response.status !== 200) throw new BoxError(BoxError.EXTERNAL_ERROR, `Unknown error with ${target}: ${response.status} ${response.text}`);