From d074e13eafb74b34b4f10521025039441ae2084a Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 17 May 2018 10:43:44 +0100 Subject: [PATCH] fix(pubsub): clear interval on error License: MIT Signed-off-by: Alan Shaw --- js/src/pubsub.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/pubsub.js b/js/src/pubsub.js index a877073e5..fc97c522e 100644 --- a/js/src/pubsub.js +++ b/js/src/pubsub.js @@ -21,6 +21,7 @@ function waitForPeers (ipfs, topic, peersToWait, callback) { const i = setInterval(() => { ipfs.pubsub.peers(topic, (err, peers) => { if (err) { + clearInterval(i) return callback(err) }