Comparing version 1.0.9 to 1.1.0
@@ -86,7 +86,7 @@ var util = require('util') | ||
if (err) { | ||
console.error('Channel_handleNext', self.name, err); | ||
console.error('Channel._handleNext', self.name, err); | ||
self._close(); | ||
self.emit('close', { reason: "error" }); | ||
} else if (!data) { | ||
console.warn('Channel_handleNext', self.name, "no data"); | ||
console.warn('Channel._handleNext', self.name, "no data"); | ||
self._close(); | ||
@@ -114,14 +114,32 @@ self.emit('close', { reason: "no_data" }); | ||
var d = q.defer(); | ||
db.createCollection('ns_' + namespace, { | ||
size: Channel.COLLECTION_SIZE, | ||
capped: true, | ||
autoIndexId: true | ||
}, function(err, collection) { | ||
if (err) { | ||
d.reject(err); | ||
} else if (!collection) { | ||
d.reject(new Error('failed to create a new namespace collection')); | ||
var name = 'ns_' + namespace; | ||
db.collection(name, { strict: true }, function(err, collection) { | ||
if (err || !collection) { | ||
console.warn('Channel.collection', 'trying to create namespace collection', name); | ||
db.createCollection(name, { | ||
size: Channel.COLLECTION_SIZE, | ||
capped: true, | ||
autoIndexId: true | ||
}, function(err, collection) { | ||
if (err) { | ||
console.error('Channel.collection', 'failed to create namespace collection', name); | ||
d.reject(err); | ||
} else if (!collection) { | ||
console.error('Channel.collection', 'failed to get namespace collection', name); | ||
d.reject(new Error('failed to create a new namespace collection')); | ||
} else { | ||
collection.insert({ init: true }, { w: 1 }, function(err, bootstrap) { | ||
if (err || !bootstrap) { | ||
console.error('Channel.collection', 'failed to bootstrap namespace collection', name); | ||
d.reject(new Error('failed to create bootstrap namespace collection')); | ||
} else { | ||
d.resolve(collection); | ||
} | ||
}); | ||
} | ||
}); | ||
} else { | ||
d.resolve(collection); | ||
} | ||
} | ||
}); | ||
@@ -128,0 +146,0 @@ return d.promise.nodeify(cb); |
{ | ||
"name": "vubsub", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "Pub/Sub for Node.js and MongoDB", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/vivocha/vubsub", |
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
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
11241
7
217