Comparing version 0.2.4 to 0.2.5
var util = require("util"), | ||
http = require("http"); | ||
var batchSize = 500, // events per batch | ||
batchInterval = 500, // ms between batches | ||
errorInterval = 1000; // ms between retries | ||
// returns an emitter which POSTs events up to 500 at a time to the given http://host:port | ||
module.exports = function(protocol, host, port) { | ||
@@ -12,3 +17,3 @@ var emitter = {}, | ||
function send() { | ||
var events = queue.splice(0, 500), | ||
var events = queue.splice(0, batchSize), | ||
body = JSON.stringify(events); | ||
@@ -27,3 +32,3 @@ | ||
if (response.statusCode !== 200) return error(response.statusCode); | ||
if (queue.length) setTimeout(send, 500); | ||
if (queue.length) setTimeout(send, batchInterval); | ||
}).on("error", function(e) { | ||
@@ -36,3 +41,3 @@ error(e.message); | ||
queue.unshift.apply(queue, events); | ||
setTimeout(send, 1000); | ||
setTimeout(send, errorInterval); | ||
} | ||
@@ -42,3 +47,3 @@ } | ||
emitter.send = function(event) { | ||
if (!closing && queue.push(event) === 1) setTimeout(send, 500); | ||
if (!closing && queue.push(event) === 1) setTimeout(send, batchInterval); | ||
return emitter; | ||
@@ -45,0 +50,0 @@ }; |
var util = require("util"), | ||
dgram = require("dgram"); | ||
// returns an emitter which sneds events one at a time to the given udp://host:port | ||
module.exports = function(protocol, host, port) { | ||
@@ -5,0 +6,0 @@ var emitter = {}, |
var util = require("util"), | ||
websocket = require("websocket"); | ||
// returns an emitter which sends events one at a time to the given ws://host:port | ||
module.exports = function(protocol, host, port) { | ||
@@ -5,0 +6,0 @@ var emitter = {}, |
@@ -1,3 +0,2 @@ | ||
var util = require("util"), | ||
url = require("url"), | ||
var url = require("url"), | ||
http = require("./emitter-http"), | ||
@@ -7,2 +6,3 @@ udp = require("./emitter-udp"), | ||
// returns an emmiter for the given URL; handles http://, udp:// or ws:// protocols | ||
module.exports = function(u) { | ||
@@ -9,0 +9,0 @@ var emitter; |
@@ -34,3 +34,3 @@ var util = require("util"), | ||
var server_options = {auto_reconnect: true}, | ||
db_options = {}; | ||
db_options = {safe: false}; | ||
@@ -37,0 +37,0 @@ module.exports = function(options) { |
{ | ||
"name": "cube", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "A system for analyzing time series data using MongoDB and Node.", | ||
"keywords": ["time series"], | ||
"keywords": [ | ||
"time series" | ||
], | ||
"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"}, | ||
"author": { | ||
"name": "Mike Bostock", | ||
"url": "http://bost.ocks.org/mike" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/square/cube.git" | ||
}, | ||
"main": "./lib/cube", | ||
"dependencies": { | ||
"mongodb": "1.0.1", | ||
"node-static": "0.6.1", | ||
@@ -16,4 +23,5 @@ "pegjs": "0.6.2", | ||
"websocket": "1.0.3", | ||
"websocket-server": "1.4.04" | ||
"websocket-server": "1.4.04", | ||
"mongodb": "~1.2.14" | ||
} | ||
} |
@@ -5,2 +5,2 @@ # Cube | ||
Want to learn more? [See the wiki.](/square/cube/wiki) | ||
Want to learn more? [See the wiki.](https://github.com/square/cube/wiki) |
@@ -37,3 +37,13 @@ var vows = require("vows"), | ||
setTimeout(function() { callback(null, getter); }, 500); | ||
function waitForEvents() { | ||
test.db.collection("test_events").count(function(err,count) { | ||
if (count == 2500) { | ||
callback(null, getter); | ||
} else { | ||
setTimeout(waitForEvents, 10); | ||
} | ||
}); | ||
} | ||
setTimeout(waitForEvents,10); | ||
}, | ||
@@ -75,2 +85,22 @@ | ||
"max expression": metricTest({ | ||
expression: "max(test(i))", | ||
start: "2011-07-17T23:47:00.000Z", | ||
stop: "2011-07-18T00:50:00.000Z", | ||
}, { | ||
36e5: [81, 2499], | ||
864e5: [81, 2499] | ||
} | ||
), | ||
"min expression": metricTest({ | ||
expression: "min(test(i))", | ||
start: "2011-07-17T23:47:00.000Z", | ||
stop: "2011-07-18T00:50:00.000Z", | ||
}, { | ||
36e5: [0, 82], | ||
864e5: [0, 82] | ||
} | ||
), | ||
"compound expression": metricTest({ | ||
@@ -77,0 +107,0 @@ expression: "max(test(i)) - min(test(i))", |
@@ -13,3 +13,3 @@ var mongodb = require("mongodb"), | ||
var client = new mongodb.Server("localhost", 27017); | ||
db = new mongodb.Db("cube_test", client), | ||
db = new mongodb.Db("cube_test", client, { safe: false }), | ||
cb = this.callback; | ||
@@ -16,0 +16,0 @@ db.open(function(error) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
741239
51
18591
6
+ Addedbson@0.1.8(transitive)
+ Addedmongodb@1.2.14(transitive)
- Removedbson@0.0.5(transitive)
- Removedmongodb@1.0.1(transitive)
Updatedmongodb@~1.2.14