diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2023-02-26 17:34:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 17:34:57 +0200 |
commit | e047225620d870b3d29824fadadd952fb4848463 (patch) | |
tree | 9db665c15774baa539ad6b5d3172347795a1e687 | |
parent | 29a62e81dd1812dfe8c5f05d9154ab974b330bb9 (diff) |
chore(ext/ffi): Use queueMicrotask in tests (#17954)
-rw-r--r-- | test_ffi/tests/event_loop_integration.ts | 4 | ||||
-rw-r--r-- | test_ffi/tests/thread_safe_test.js | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test_ffi/tests/event_loop_integration.ts b/test_ffi/tests/event_loop_integration.ts index 28152dabf..55dc563bb 100644 --- a/test_ffi/tests/event_loop_integration.ts +++ b/test_ffi/tests/event_loop_integration.ts @@ -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(); diff --git a/test_ffi/tests/thread_safe_test.js b/test_ffi/tests/thread_safe_test.js index c5e9c74b7..237a8d713 100644 --- a/test_ffi/tests/thread_safe_test.js +++ b/test_ffi/tests/thread_safe_test.js @@ -82,7 +82,7 @@ const cleanupCallback = new Deno.UnsafeCallback( { parameters: [], result: "void" }, () => { console.log("Callback being called"); - Promise.resolve().then(() => cleanup()); + queueMicrotask(() => cleanup()); }, ); |