X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fpool.lisp;h=8a891f41b49b4d930061348c63f0e63b123c0e0c;hb=8b3d6ea42a982d60b4db9116e6aa9b94372cccbd;hp=38d32cdd21a125c543bcbd4471b087c7cd4ffd3b;hpb=96cc4dd98e77b8a1f83fa850e3348219c957b7ef;p=clsql.git diff --git a/sql/pool.lisp b/sql/pool.lisp index 38d32cd..8a891f4 100644 --- a/sql/pool.lisp +++ b/sql/pool.lisp @@ -85,8 +85,9 @@ chance to do cleanup." ;;not the list). Multiple threads getting to this test at the ;;same time might result in the free-connections getting ;;longer... meh. - ((>= (length (free-connections pool)) - *db-pool-max-free-connections*) + ((and *db-pool-max-free-connections* + (>= (length (free-connections pool)) + *db-pool-max-free-connections*)) (%pool-force-disconnect database) (with-process-lock ((conn-pool-lock pool) "Remove extra Conn") (setf (all-connections pool) @@ -120,6 +121,8 @@ chance to do cleanup." (database-execute-command "DISCARD ALL" database))))) (defun clear-conn-pool (pool) + "Be careful this function will disconnect connections without regard +to whether another thread is actively using them." (with-process-lock ((conn-pool-lock pool) "Clear pool") (mapc #'%pool-force-disconnect (all-connections pool)) (setf (all-connections pool) nil