0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-25 09:19:32 +01:00
mongodb/jstests/parallel/checkMultiThread.js

17 lines
414 B
JavaScript

load('jstests/libs/parallelTester.js');
var start = new Date();
print("start: " + start);
var func = function() {
db.runCommand({sleep: 1, seconds: 10000});
return new Date();
};
let a = new Thread(func);
let b = new Thread(func);
a.start();
b.start();
a.join();
b.join();
assert.lt(a.returnData() - start, 15000, "A took more than 15s");
assert.lt(b.returnData() - start, 15000, "B took more than 15s");