Comparing version 0.2.1 to 0.2.2
@@ -28,3 +28,2 @@ /* vim: set expandtab tabstop=2 shiftwidth=2 foldmethod=marker: */ | ||
} | ||
/** | ||
@@ -160,7 +159,2 @@ * @ 连接数组 | ||
} | ||
var n = o._queue.size(); | ||
if (n > 0) { | ||
o.emit('busy', n, _options.maxconnections); | ||
} | ||
}; | ||
@@ -225,2 +219,6 @@ /* }}} */ | ||
this._queue.push([sql, tmout, cb], tmout); | ||
var n = this._queue.size(); | ||
if (n > 0) { | ||
this.emit('busy', n, _options.maxconnections); | ||
} | ||
}; | ||
@@ -227,0 +225,0 @@ /* }}} */ |
{ | ||
"name": "easymysql", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "Aleafs Zhang (zhangxc83@gmail.com)", | ||
@@ -5,0 +5,0 @@ "contributors": [], |
@@ -27,3 +27,3 @@ [![Build Status](https://secure.travis-ci.org/aleafs/easymysql.png?branch=master)](http://travis-ci.org/aleafs/easymysql) | ||
var mysql = Client.create({ | ||
'maxconnection' : 10 | ||
'maxconnections' : 10 | ||
}); | ||
@@ -65,9 +65,9 @@ | ||
project: easymysql | ||
commits: 130 | ||
commits: 139 | ||
files : 16 | ||
authors: | ||
122 aleafs 93.8% | ||
4 tangyao 3.1% | ||
3 zhaolei 2.3% | ||
1 紫胤 0.8% | ||
126 aleafs 90.6% | ||
8 zhaolei 5.8% | ||
4 tangyao 2.9% | ||
1 紫胤 0.7% | ||
@@ -74,0 +74,0 @@ ``` |
@@ -111,3 +111,29 @@ /* vim: set expandtab tabstop=2 shiftwidth=2 foldmethod=marker: */ | ||
/* {{{ should_emit_busy_works_fine() */ | ||
it('should_emit_busy_works_fine', function (done) { | ||
var _me = Cluster.create({'maxconnections' : 1}); | ||
_me.addserver(Common.config); | ||
var _busyResults = []; | ||
_me.on('busy', function (queuesize, maxconnections, which) { | ||
maxconnections.should.eql(1); | ||
_busyResults.push(queuesize); | ||
}); | ||
var num = 0; | ||
for (var i = 0; i < 3; i++) { | ||
_me.query('SELECT SLEEP(0.1)', function (e, r) { | ||
num ++; | ||
should.not.exist(e); | ||
if (num >= 3) { | ||
_busyResults.reduce(function (a, b) { | ||
return a + b; | ||
}).should.eql(3); | ||
done(); | ||
} | ||
}); | ||
} | ||
}); | ||
/* }}}*/ | ||
}); | ||
32669
1001