Skip to content

Commit

Permalink
feat(db_util): add function "ensureAsync"
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Oct 12, 2020
1 parent e17762d commit 971b02d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/mongodb-memory-server-core/src/util/db_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ export async function killProcess(childprocess: ChildProcess, name: string): Pro
childprocess.kill('SIGINT');
});
}

/**
* Call "setImmediate" to ensure an function is exectued on next event loop
*/
export async function ensureAsync(): Promise<void> {
return new Promise((res) => setImmediate(res));
}

0 comments on commit 971b02d

Please sign in to comment.