mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Another attempt to make "run --once" test more reliable.
This commit is contained in:
@@ -14,8 +14,23 @@ if (process.env.RUN_ONCE_OUTCOME === "hang") {
|
||||
|
||||
if (process.env.RUN_ONCE_OUTCOME === "mongo") {
|
||||
var test = new Mongo.Collection('test');
|
||||
Meteor.startup(function () {
|
||||
test.insert({ value: 86 });
|
||||
var triesLeft = 10;
|
||||
|
||||
function tryInsert() {
|
||||
try {
|
||||
test.insert({ value: 86 });
|
||||
} catch (e) {
|
||||
if (--triesLeft <= 0) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
console.log("insert failed; retrying:", String(e.stack || e));
|
||||
setTimeout(tryInsert, 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
process.exit(test.findOne().value);
|
||||
});
|
||||
}
|
||||
|
||||
Meteor.startup(tryInsert);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user