Skip to content

Commit

Permalink
Merge branch 'fix-emitter-close'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 18, 2011
2 parents 7f5608b + 33d47ab commit 1b8779e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/cube/server/emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ module.exports = function() {
}
}

function closeWhenDone() {
if (socket) {
if (!socket.bytesWaitingToFlush) close();
else setTimeout(closeWhenDone, 1000);
}
}

function open() {
timeout = 0;
close();
Expand Down Expand Up @@ -59,7 +66,7 @@ module.exports = function() {
};

emitter.close = function() {
close();
closeWhenDone();
return emitter;
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "cube",
"version": "0.0.9",
"version": "0.0.10",
"description": "A system for time series visualization using MongoDB, Node and D3.",
"keywords": ["time series", "visualization"],
"homepage": "http://square.github.com/cube/",
"author": {"name": "Mike Bostock", "url": "http://bost.ocks.org/mike"},
"repository": {"type": "git", "url": "http://github.com/square/cube.git"},
"main": "./lib/cube",
"dependencies": {
"d3": "2.4.2",
"d3": "2.5.1",
"mongodb": "0.9.6-15",
"pegjs": "0.6.2",
"vows": "0.5.11",
Expand Down

0 comments on commit 1b8779e

Please sign in to comment.