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:
parent
29a62e81dd
commit
e047225620
2 changed files with 3 additions and 3 deletions
|
@ -29,7 +29,7 @@ const dylib = Deno.dlopen(
|
||||||
let retry = false;
|
let retry = false;
|
||||||
const tripleLogCallback = () => {
|
const tripleLogCallback = () => {
|
||||||
console.log("Sync");
|
console.log("Sync");
|
||||||
Promise.resolve().then(() => {
|
queueMicrotask(() => {
|
||||||
console.log("Async");
|
console.log("Async");
|
||||||
callback.unref();
|
callback.unref();
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ console.log("STORED_FUNCTION called");
|
||||||
// Wait to make sure synch logging and async logging
|
// Wait to make sure synch logging and async logging
|
||||||
await new Promise((res) => setTimeout(res, 100));
|
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.
|
// must resolve and unref before isolate exists.
|
||||||
// One ref'ing has been done by `threadSafe` constructor.
|
// One ref'ing has been done by `threadSafe` constructor.
|
||||||
callback.ref();
|
callback.ref();
|
||||||
|
|
|
@ -82,7 +82,7 @@ const cleanupCallback = new Deno.UnsafeCallback(
|
||||||
{ parameters: [], result: "void" },
|
{ parameters: [], result: "void" },
|
||||||
() => {
|
() => {
|
||||||
console.log("Callback being called");
|
console.log("Callback being called");
|
||||||
Promise.resolve().then(() => cleanup());
|
queueMicrotask(() => cleanup());
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue