mirror of https://github.com/seald/nedb
parent
94cac41acb
commit
61fbf77d18
@ -0,0 +1,32 @@ |
||||
var fs = require('fs') |
||||
, child_process = require('child_process') |
||||
, async = require('async') |
||||
, N = 64 // One file descriptor too many
|
||||
, i =0 |
||||
; |
||||
|
||||
function multipleOpen (filename, N, callback) { |
||||
async.whilst( function () { return i < N; } |
||||
, function (cb) { |
||||
fs.open(filename, 'r', function (err, fd) { |
||||
i += 1; |
||||
return cb(err); |
||||
}); |
||||
} |
||||
, callback); |
||||
} |
||||
|
||||
|
||||
async.waterfall([ |
||||
function (cb) { |
||||
multipleOpen('./test_lac/openFdsTestFile', 2 * N + 1, function (err) { |
||||
if (!err) { console.log("No error occured while opening a file too many times"); } |
||||
return cb(); |
||||
}) |
||||
} |
||||
, function (cb) { |
||||
multipleOpen('./test_lac/openFdsTestFile2', N, function (err) { |
||||
if (err) { console.log('An unexpected error occured when opening file not too many times: ' + err); } |
||||
}) |
||||
} |
||||
]); |
@ -0,0 +1,2 @@ |
||||
ulimit -n 128 |
||||
node ./test_lac/openFds.test.js |
@ -0,0 +1 @@ |
||||
Random stuff |
@ -0,0 +1 @@ |
||||
Some other random stuff |
Loading…
Reference in new issue