FSX / momoko

Wraps (asynchronous) Psycopg2 for Tornado.
http://momoko.61924.nl/
Other
359 stars 73 forks source link

made connection allways synchronous. #158

Closed mlmarius closed 6 years ago

mlmarius commented 7 years ago

I made the call to psycopg2 connect method syncrhonous. Now when the script attempts to connect to the db server and the db server is not available for some reason, momoko properly detects the dead connection. As soon as the server is available and the app is accessed, momoko properly connects to the database.

haizaar commented 6 years ago

Good day,

Thanks for the pool request and apologies for the late response.

I'm not sure I understand what you are trying to do though. The whole idea of async programming is to perform IO bound operations asynchronously. Performing connect in synchronous manner will effectively block your whole (async) application until connection is established/fails - which can take very long time if database server is offline/firewalled.

Eventually, the future returned by connect method will resolve by returning connection object or raising exception.

I will close it for now. Feel free to comment to continue the discussion.