Skip to content

Commit 635fe21

Browse files
authored
Merge pull request #15788 from yogesh968/fixes
fix(test): stop retry loop after successful clearTestData() drop
2 parents 4e36ab6 + 8523a46 commit 635fe21

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)