Open ArrowZQ opened 8 years ago
Can you post a complete example that illustrates the problem?
Here is momoko poll:
ioloop = tornado.ioloop.IOLoop.instance()
dbpool = momoko.Pool(
dsn='dbname={dbname} user={user} password={pwd} host={host} port={port}',
cursor_factory=psycopg2.extras.RealDictCursor,
size=int(const.postgresql.get("size")),
max_size=int(const.postgresql.get("max_size")),
raise_connect_errors=True if const.postgresql.get("raise_connect_errors") == 'True' else False,
reconnect_interval=int(const.postgresql.get("reconnect_interval")),
auto_shrink=True,
shrink_period=datetime.timedelta(seconds=1),
shrink_delay=datetime.timedelta(minutes=5),
ioloop=ioloop
)
future = dbpool.connect()
ioloop.add_future(future, lambda f: ioloop.stop())
ioloop.start()
here is request handler:
@gen.coroutine
def get(self, *args, **kwargs):
pass
The following can be printed out timeout of ioloop
import time
io_loop = tornado.ioloop.IOLoop.instance()
for timeout in io_loop._timeouts:
print timeout.callback
print timeout.deadline - time.time()
when i set the
auto_shrink
ofmomoko.Pool()
parameters equal to True, and sendGET
request to tornado server, this request don't do nothing.but i foud out one request add one timeout of ioloop, and the callback of this timeout is None, the deadline of this timeout minus
time.time()
equal to 3595 or so. the max number oflen(tornado.ioloop.IOLoop.instance()._timeouts)
equal to 500 or so, don't continue to increase.if i set the auto_shrink of momoko.Pool parameters equal to False, will not appear above the problem.
Looking forward to your reply.