From 63e9bc8dabc98d141f3e648b4baa1937737901a8 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Thu, 27 Jun 2013 08:11:49 +0000 Subject: [PATCH] Improved the fix --- consumer.js | 2 +- worker.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/consumer.js b/consumer.js index 93aabfd..4b8e37b 100644 --- a/consumer.js +++ b/consumer.js @@ -128,7 +128,7 @@ function Consumer() { var nextStreamID = 1; function storeStream(stream) { nextStreamID = nextStreamID++ % 10000; - while (streams.hasOwnProperty(nextStreamID)) { nextStreamID++; } + while (streams.hasOwnProperty(nextStreamID)) { nextStreamID++ % 10000; } var id = nextStreamID; streams[id] = stream; stream.id = id; diff --git a/worker.js b/worker.js index 8fa4f34..a18309a 100644 --- a/worker.js +++ b/worker.js @@ -153,7 +153,7 @@ function Worker(vfs) { var nextStreamID = 1; function storeStream(stream) { nextStreamID = nextStreamID++ % 10000; - while (streams.hasOwnProperty(nextStreamID)) { nextStreamID++; } + while (streams.hasOwnProperty(nextStreamID)) { nextStreamID++ % 10000; } var id = nextStreamID; streams[id] = stream; stream.id = id;