1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore(ext/ffi): Use queueMicrotask in tests (#17954)

This commit is contained in:
Aapo Alasuutari 2023-02-26 17:34:57 +02:00 committed by GitHub
parent 29a62e81dd
commit e047225620
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,7 @@ const dylib = Deno.dlopen(
let retry = false;
const tripleLogCallback = () => {
console.log("Sync");
Promise.resolve().then(() => {
queueMicrotask(() => {
console.log("Async");
callback.unref();
});
@ -66,7 +66,7 @@ console.log("STORED_FUNCTION called");
// Wait to make sure synch logging and async logging
await new Promise((res) => setTimeout(res, 100));
// Ref once to make sure both `Promise.resolve().then()` and `setTimeout()`
// Ref once to make sure both `queueMicrotask()` and `setTimeout()`
// must resolve and unref before isolate exists.
// One ref'ing has been done by `threadSafe` constructor.
callback.ref();

View file

@ -82,7 +82,7 @@ const cleanupCallback = new Deno.UnsafeCallback(
{ parameters: [], result: "void" },
() => {
console.log("Callback being called");
Promise.resolve().then(() => cleanup());
queueMicrotask(() => cleanup());
},
);