Closed skotori closed 2 years ago
the django-db-connection-pool is installed by 'pip install django-db-connection-pool'
Has django-db- connection-pool been installed yet?
Has django-db- connection-pool been installed yet?
yes
Maybe Django 4.0 changed the database backends API.What is the latest version of Django based on
Django started after it was lowered from 4.0 to 3.2.Are there plans to support Django version 4.0
Django started after it was lowered from 4.0 to 3.2.Are there plans to support Django version 4.0
Caused by Deprecate ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy(), I will fix it soon
ImproperlyConfigured
has been fixed in django4_support branch, You can test it in your case.
installed the django4_support branch by 'pip install git+https://github.com/altairbow/django-db-connection-pool.git@django4_support', start normally in Django 4.0 environment
There is a problem. I don't know if it's because of my code. Start 100 threads to execute database insert, and the code will be stuck after execution for a period of time.
The length of time the code runs before it gets stuck is proportional to POOL_SIZE.
My configuration is "'POOL_OPTIONS': { 'POOL_SIZE': 10, 'MAX_OVERFLOW': 10, 'RECYCLE': 24 60 60 }". Is it because threads do not share a connection, and then the connection expires too long, resulting in thread blocking.
Has conn.close been called after your thread done it's work?
Has conn.close been called after your thread done it's work?
No, the connection is not closed.
You should call conn.close
to release the connection
You should call
conn.close
to release the connection
But I use Django's ORM, MODEL method.
Django close all database connections automatically after django.core.signals.request_finished
received, means Django won't release database connection before your threads finish, don't start too many threads for single user request, it's not a good idea in web development, If it's a background task, you have two choices: 1. Increase MAX_OVERFLOW or POOL_SIZE 2. in your code,call conn.close() to release database connection to pool manually
fixed by #27
ok, thank you.
Can we get a new release with this fix in? 1.0.7 does not contain this fix.
Can we get a new release with this fix in? 1.0.7 does not contain this fix.
1.1.0 has been released.
File "...\lib\site-packages\django\db\utils.py", line 122, in load_backend raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'dj_db_conn_pool.backends.mysql' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3'