fix crash

This commit is contained in:
Girish Ramakrishnan
2025-07-08 18:07:19 +02:00
parent 85d9c91e5e
commit e3bec5039b
+2 -2
View File
@@ -381,7 +381,7 @@ async function pipeContainerToMap(name, statsMap) {
// we used to poll before instead of a stream. but docker caches metrics internally and rate logic has to handle dups
const [error, statsStream] = await safe(docker.getStats(name, { stream: true }));
if (error) return; // container stopped or missing, silently ignore
if (error) return null; // container stopped or missing, silently ignore
statsStream.on('error', (error) => debug(error));
statsStream.on('data', (data) => {
@@ -469,7 +469,7 @@ async function getStream(options) {
read(/*size*/) { /* ignored, we push via interval */ },
destroy(error, callback) {
clearInterval(intervalId);
containerStreamPromises.forEach(cs => { if (cs.status === 'fulfilled') cs.value.destroy(error); });
containerStreamPromises.forEach(cs => { if (cs.status === 'fulfilled' && cs.value) cs.value.destroy(error); });
callback(error);
}
});