adapt callback to promise that block tests

This commit is contained in:
Nacho Codoñer
2024-10-29 15:45:32 +01:00
parent 1695b2312b
commit ac103bad1f

View File

@@ -226,14 +226,9 @@ export class OplogHandle {
);
try {
const isMasterDoc = await new Promise<any>((resolve, reject) => {
this._oplogLastEntryConnection!.db
.admin()
.command({ ismaster: 1 }, (err: Error | null, result: any) => {
if (err) reject(err);
else resolve(result);
});
});
const isMasterDoc = await this._oplogLastEntryConnection!.db
.admin()
.command({ ismaster: 1 });
if (!(isMasterDoc && isMasterDoc.setName)) {
throw new Error("$MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set");
@@ -426,4 +421,4 @@ export function idForOp(op: OplogEntry): string {
} else {
throw Error("Unknown op: " + JSON.stringify(op));
}
}
}