Open nicolo-faedi opened 2 years ago
Just tried to debug a little bit by my self, and I noted there's a
{'r': 10072, 'action': 'value', 'ffid': 4, 'key': [], 'val': ''}
fired from Javascript to Python, completely out of my control, which breaks the code.
Python main thread is likely getting blocked (since you're using forEach
, you're not waiting for last computation), use await
to make sure you wait for a response from the Python side before sending more calls.
for await (const value of db_data) {
const python_res = await pythonia_api.func(value)
// do something with python_res
}
Hello
Is this still an issue? Have you gotten this to work?
Hello! I'm actually using Pythonia as bridge to include some python libraries and functions inside my production js server which has a RestFull API for quering db data.
First i'm loading all the python modules i need, then i export all the async functions to distribute them over my application. When i call pythonia functions in a foreach loop, i got this behaviour i can't solve. (i've also tried with a sync loop, same result) Some data will be returned by python function and printed, then it stops.
The error:
Here my sample code:
In my Express api
My Pythonia API
Thanks for your attention