1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

test(ext/ffi): Increase timeout value in event loop integration test callback (#18394)

This commit is contained in:
Aapo Alasuutari 2023-03-25 09:18:41 +02:00 committed by GitHub
parent 70e2e8f2dd
commit 1c6b797383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,7 @@ const tripleLogCallback = () => {
callback.ref(); callback.ref();
dylib.symbols.call_stored_function_thread_safe_and_log(); dylib.symbols.call_stored_function_thread_safe_and_log();
} }
}, 10); }, 100);
}; };
const callback = Deno.UnsafeCallback.threadSafe( const callback = Deno.UnsafeCallback.threadSafe(
@ -60,11 +60,12 @@ dylib.symbols.store_function(callback.pointer);
// Synchronous callback logging // Synchronous callback logging
console.log("SYNCHRONOUS"); console.log("SYNCHRONOUS");
// This function only calls the callback, and does not log.
dylib.symbols.call_stored_function(); dylib.symbols.call_stored_function();
console.log("STORED_FUNCTION called"); 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, 200));
// Ref once to make sure both `queueMicrotask()` 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.
@ -73,4 +74,5 @@ callback.ref();
console.log("THREAD SAFE"); console.log("THREAD SAFE");
retry = true; retry = true;
// This function calls the callback and logs 'STORED_FUNCTION called'
dylib.symbols.call_stored_function_thread_safe_and_log(); dylib.symbols.call_stored_function_thread_safe_and_log();