Skip to content

Commit

Permalink
gate-executor 1.1.0; resolves #549; test for memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Sep 27, 2016
1 parent 0a584ea commit 065f12b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"dependencies": {
"archy": "1.0.0",
"eraro": "0.4.1",
"gate-executor": "1.0.0",
"gate-executor": "1.1.0",
"gex": "0.2.2",
"jsonic": "0.2.2",
"lodash": "4.15.0",
Expand Down
1 change: 1 addition & 0 deletions test/memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require('../')({log: 'silent'})
.ready(function () {
var start = Date.now()
var count = 0

for (var i = 0; i < SIZE; ++i) {
this.act('a:1', {x: i}, function (ignore, out) {
++count
Expand Down
32 changes: 32 additions & 0 deletions test/seneca.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,4 +1360,36 @@ describe('seneca', function () {

.ready(done)
})

it('memory', function (done) {
var SIZE = 1000

Seneca({log: 'silent'})
.error(done)
.add('a:1', function (msg, done) {
done(null, {x: msg.x})
})
.ready(function () {
var start = Date.now()
var count = 0

for (var i = 0; i < SIZE; ++i) {
this.act('a:1', {x: i}, function (ignore, out) {
++count

if (SIZE === count) validate(start)
})
}
})

function validate (start) {
var end = Date.now()
expect(end - start).below(1000)

var mem = process.memoryUsage()
expect(mem.rss).below(180000000)

done()
}
})
})

0 comments on commit 065f12b

Please sign in to comment.