-
Notifications
You must be signed in to change notification settings - Fork 2
Make query inside warp framework call #88
Comments
Do you have a more specific error, I can't quite find which crate returns a "cannot block executor" error? |
He's probably waiting for the future's result in a main event loop, effectively blocking it for longer than allowed, which probably trips that error. |
Soory for such a late reply, check please this code for the idea of what I'm trying to do (it won't compile, it's the ideal scenario for web application workflow): https://github.com/madmaxio/warp-tiberius Basically: Get warp request, use some input data for query, execute the future with DB request or a synchoronous DB request, return results to user. |
I've had the same issue before when I tried (for research) to mix warp and tiberius. The issues arises from warp. Its executor framework detects long running tasks inside handlers. It has a default timeout for this. Warp won't allow you to fetch data from a database and wait for that data inside its request handlers. That kind of stuff can take an arbitrarily long time to complete! You best bet would be to implement asynchronous processing. Inside the warp handler schedule a task to fetch the data you require and do that work in another thread, and notify the client of an URL it can regularly pool to get the results when they are ready or use some other method like websockets to notify the client when the data is ready. |
Trying to make query inside warp framework call, and failing with cannot block executor error. Warp is popular webframework https://github.com/seanmonstar/warp.
Perhaps i should pass a future with a query somehow?
The text was updated successfully, but these errors were encountered: