Use Python 3 compatible 'queue' import

This commit is contained in:
Wouter Bolsterlee
2016-03-20 22:06:00 +01:00
committed by Wouter Bolsterlee
parent a5b32210d0
commit c67ceaab04

View File

@@ -4,10 +4,11 @@ HappyBase connection pool module.
import contextlib
import logging
import Queue
import socket
import threading
from six.moves import queue
from thriftpy.thrift import TException
from .connection import Connection
@@ -61,7 +62,7 @@ class ConnectionPool(object):
"Initializing connection pool with %d connections", size)
self._lock = threading.Lock()
self._queue = Queue.LifoQueue(maxsize=size)
self._queue = queue.LifoQueue(maxsize=size)
self._thread_connections = threading.local()
connection_kwargs = kwargs
@@ -81,7 +82,7 @@ class ConnectionPool(object):
"""Acquire a connection from the pool."""
try:
return self._queue.get(True, timeout)
except Queue.Empty:
except queue.Empty:
raise NoConnectionsAvailable(
"No connection available from pool within specified "
"timeout")