Skip to content

Commit 8523a46

Browse files
appleapple
authored andcommitted
fixes utils.js
1 parent be6a2c8 commit 8523a46

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/util.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ exports.clearTestData = async function clearTestData(db) {
1919
retries -= 1;
2020
try {
2121
await _inner();
22+
return;
2223
} catch (err) {
23-
if (err instanceof mongoose.mongo.MongoWriteConcernError && /operation was interrupted/.test(err.message)) {
24+
const retryable = err instanceof mongoose.mongo.MongoWriteConcernError && /operation was interrupted/.test(err.message);
25+
if (retryable && retries > 0) {
2426
console.log('DropDB operation interrupted, retrying'); // log that a error was thrown to know that it is going to re-try
2527
continue;
2628
}

0 commit comments

Comments
 (0)