I found that connection will close after I set isolation level twice.

I accidentally set this twice and found a unexpected behavior. ( at least, I do not expect that.

After I set some log, I found the reason is that this line https://github.com/aio-libs/aiomysql/blob/master/aiomysql/pool.py#L223 return True.

example code is here https://gist.github.com/Bear1110/1115bef832836d31079d0ceb194e56da.

OUTPUT is below

1 1
False
[{'id': 1}, {'id': 2}]
1 1
------------------------------
1 1
True
[{'id': 1}, {'id': 2}]
0 0

The last line 0 0 is meaning pool close the connection after released connection. print(pool.freesize, pool.size)

I found that flag which is conn.get_transaction_status() meaning is here.

But, actually I do not know why this flag become True after I set isolation level twice ?

I just wonder why need close connection when this flag is True ?

Could any one help me understand this logic ? Thanks

I post discussion here, too. Pypi package is here.

0

There are 0 best solutions below