fix crash
This commit is contained in:
+2
-2
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user