Browse files

v0.3.1 Minor cleanup and bug fixes

v0.3.1
* Added setTimeout to nextTick on startup to give Mongo a chance to get
connceted to
* Minor bug fix due to EventEmitter treating 'error' events specially
* Tweak to once listeners to call next if it exists.  Shouldn't change
anything but it is good practice.
  • Loading branch information...
1 parent 3770d32 commit 6fc9d992792bdcc8748be2a81731c3776c4f0049 @jdarling committed Jan 14, 2013
Showing with 19 additions and 6 deletions.
  1. +11 −6 lib/MongoMQ.js
  2. +3 −0 lib/eventer.js
  3. +5 −0 readme.md
View
17 lib/MongoMQ.js
@@ -45,11 +45,13 @@ MongoMQ.prototype.checkConnection = function(callback){
var self = this;
var waitForStarted = function(){
process.nextTick(function(){
- if(self.isopen){
- callback(null, self);
- }else{
- waitForStarted();
- }
+ setTimeout(function(){
+ if(self.isopen){
+ callback(null, self);
+ }else{
+ waitForStarted();
+ }
+ }, 100);
});
};
if(self.isopen){
@@ -299,12 +301,15 @@ MongoMQ.prototype.once = function(event, options, callback){
options = {};
}
options=options||{};
- var monitor = new QueueMonitor(self, event, options, function(err, response){
+ var monitor = new QueueMonitor(self, event, options, function(err, response, next){
if(err){
self.emitter.call('error', err);
}
(callback||function(){})(err, response);
monitor.stop();
+ if(next){
+ next();
+ }
});
};
MongoMQ.prototype.once.description = 'Adds a one time listener for a specific event.';
View
3 lib/eventer.js
@@ -1,9 +1,12 @@
var util = require('util');
var EventEmitter = require('events').EventEmitter;
+var defaultError = function () {};
+
var Eventer = module.exports = function(hosting){
var self = this;
self.hosting = hosting;
+ self.on('error', defaultError);
};
util.inherits(Eventer, EventEmitter);
View
5 readme.md
@@ -235,6 +235,11 @@ Update History
v0.3 Update History
-------------------
+v0.3.1
+ * Added setTimeout to nextTick on startup to give Mongo a chance to get connceted to
+ * Minor bug fix due to EventEmitter treating 'error' events specially
+ * Tweak to once listeners to call next if it exists. Shouldn't change anything but it is good practice.
+
v0.3.0
* Initial release of v0.3.x, includes many new features and functionality along with many bug fixes.

0 comments on commit 6fc9d99

Please sign in to comment.