Open tonioss22 opened 2 years ago
I've added this since i have been looking for a way to unblock my event loop for a couple of days now, originally looking into worker threads but node-java does not support them yet (don't know if they ever will). This is a solution to that problem and i'm sure others would like to use it aswell.
Can you please merge it? @jasonozias
Can you please merge it? @jasonozias
Hey Tomas, you can still use the same idea but with a wrapper while waiting for this PR to be accepted. The solution i provided seem to slow down the event loop on bigger request, but it's still better then having it completely stop. I ended up running my biggest query with pyodbc in a worker node because i wanted faster results. But this may work quite well for your application. If you need any support, you can contact me via email.
These functions will not block the event loop compared to the original toObject function. They also return from a promise instead of a callback. These functions are really useful when dealing with big data as return value. Performances are similar to the original method in terms of speed.