Exemplo n.º 1
0
 def connect(self, db_module, connect_timeout, *args, **kw):
     timeout = api.exc_after(connect_timeout, ConnectTimeout())
     try:
         from eventlib import tpool
         try:
             # *FIX: this is a huge hack that will probably only work for MySQLdb
             autowrap = (db_module.cursors.DictCursor, )
         except:
             autowrap = ()
         conn = tpool.execute(db_module.connect, *args, **kw)
         return tpool.Proxy(conn, autowrap=autowrap)
     finally:
         timeout.cancel()
Exemplo n.º 2
0
def _getaddrinfo_tpool(*args, **kw):
    from eventlib import tpool
    return tpool.execute(__socket.getaddrinfo, *args, **kw)
Exemplo n.º 3
0
def _gethostbyname_tpool(name):
    from eventlib import tpool
    return tpool.execute(__socket.gethostbyname, name)
Exemplo n.º 4
0
def _getaddrinfo_tpool(*args, **kw):
    from eventlib import tpool
    return tpool.execute(
        __socket.getaddrinfo, *args, **kw)
Exemplo n.º 5
0
def _gethostbyname_tpool(name):
    from eventlib import tpool
    return tpool.execute(
        __socket.gethostbyname, name)