Skip to content

Commit

Permalink
chore(ext/ffi): Use queueMicrotask in tests (denoland#17954)
Browse files Browse the repository at this point in the history
  • Loading branch information
aapoalas committed Feb 26, 2023
1 parent 29a62e8 commit e047225
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test_ffi/tests/event_loop_integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test_ffi/tests/thread_safe_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const cleanupCallback = new Deno.UnsafeCallback(
{ parameters: [], result: "void" },
() => {
console.log("Callback being called");
Promise.resolve().then(() => cleanup());
queueMicrotask(() => cleanup());
},
);

Expand Down

0 comments on commit e047225

Please sign in to comment.