superagent: retry in graphs logic to workaround node socket issue
https://github.com/nodejs/undici/issues/3492
This commit is contained in:
+3
-1
@@ -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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user