]> jfr.im git - irc/rizon/acid.git/commit
Add connection pool for database connections
authorAdam <redacted>
Thu, 15 Jan 2015 06:11:29 +0000 (01:11 -0500)
committerAdam <redacted>
Thu, 15 Jan 2015 06:11:29 +0000 (01:11 -0500)
commitb4079de9efb8f652cd590d6a749c47c8d027d40d
treea4c7744514f8f8d7ae0888cdbb00b8d0afd1ea3b
parentd24274a9c449032a05b5ace3492b26c5b6ab975e
Add connection pool for database connections

Pull connectins from the pool when doing queries in a thread

mysql-python (and all mysql drivers I can find) have a threadsafety
value of 1 (see PEP-249) which makes it unsafe to use the same
connection from more than one thread.

Trivia in particular used to do this extensively, which is what prompted
https://gitlab.com/rizon/mysql-python/commit/c09cfd229176bd280bfb0384aaed7d07c42bbc0a,
however this fix is not correct because both mysql_query and
mysql_store_result both need to be called in the mutex lock, which this
doesn't do. However this fixes segfaults from causing libmysqlclient
going multithreaded, so it works well enough in production.
pyva/config.example.ini
pyva/populate-zipcodes.py
pyva/pyva/src/main/python/core.py
pyva/pyva/src/main/python/internets/cmd_user.py
pyva/pyva/src/main/python/plugin.py
pyva/pyva/src/main/python/pool.py [new file with mode: 0644]
pyva/pyva/src/main/python/pseudoclient/sys_base.py