Comments (6)
Do you mean the JavaScript runtime or the tokio runtime? The JavaScript runtime is single threaded and any time JavaScript is being executed (i.e., when you have access to a Context
) it is blocked.
from neon.
Yes i mean javascript. That makes sense, however in regular javascript you can call an async function that loops and the javascript scheduler will move between different pending promises (ie like the loop call future will be moved off main thread to complete other tasks before being moved back on). However that doesnt seem to be the case when im doing calls to neon
from neon.
And example of this would be
Const a = asyncfncall();
Console.log("called async fn");
... other code
Await a;
With regular javascript this works fine. However with neon it doesn't
from neon.
just for sure, does the following work for you? @Will-Smith11
console.log("called async fn");
// ... other code
await asyncfncall();
Do you do any blocking in asyncfncall
? Could you please give a repo to reproduce this?
from neon.
just for sure, does the following work for you? @Will-Smith11
console.log("called async fn"); // ... other code await asyncfncall();Do you do any blocking in
asyncfncall
? Could you please give a repo to reproduce this?
I was able to resolve this. sorry im a bit of a ts/js noob compared to rust. I was able to fix this by just injecting a promise timeout into my async fn call to encourage the runtime to park the task.
from neon.
Glad you figured it out! Resolving a promise usually isn't enough to yield to the event loop because it's a microtask and those get pushed to the front of the queue.
setTimeout, setImmediate, etc, will yield because those push to the back.
from neon.
Related Issues (20)
- Hope support Node 18.x HOT 3
- Feature request: Safer SysContext via thread-locals HOT 7
- Added into awesome directory HOT 1
- The garbage collector thinks my object is garbage :( HOT 1
- Question: Calling JS callbacks in rayon HOT 2
- Seg fault when linked with a C library HOT 8
- How to callback as event handler multiple times from multiple threads? HOT 2
- Copying binaries when neon package is not a root package in conjunction with cross. HOT 4
- Question: How to return something that borrows from the function context? HOT 5
- How to turn Rust Image buffer Vec<u8> to JsBuffer? HOT 2
- `register_module!` is unhygenic HOT 1
- Clean-up sys bindings orgnaization
- Remove the `build` function
- Trouble passing this to an async method in a neon class HOT 3
- Question: Logging HOT 4
- Can not work on Windows HOT 2
- neon error when installing native-voxel-generator HOT 1
- Move `root` method to `Value` trait HOT 1
- JsError doesn't work on non-wasm targets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neon.