mongo/jstests/libs/wait_for_command.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

16 lines
467 B
JavaScript

export const waitForCommand = function (waitingFor, opFilter, myDB) {
let opId = -1;
assert.soon(function () {
jsTest.log.info(`Checking for ${waitingFor}`);
const curopRes = myDB.currentOp();
assert.commandWorked(curopRes);
const foundOp = curopRes["inprog"].filter(opFilter);
if (foundOp.length == 1) {
opId = foundOp[0]["opid"];
}
return foundOp.length == 1;
});
return opId;
};