Propagated database clone settings to new connections.

This commit is contained in:
Aymeric Augustin 2015-09-07 22:59:13 +02:00
parent 0bd58e0efb
commit e8b49d4cc4
1 changed files with 5 additions and 1 deletions

View File

@ -233,7 +233,11 @@ def _init_worker(counter):
for alias in connections: for alias in connections:
connection = connections[alias] connection = connections[alias]
settings_dict = connection.creation.get_test_db_clone_settings(_worker_id) settings_dict = connection.creation.get_test_db_clone_settings(_worker_id)
connection.settings_dict = settings_dict # connection.settings_dict must be updated in place for changes to be
# reflected in django.db.connections. If the following line assigned
# connection.settings_dict = settings_dict, new threads would connect
# to the default database instead of the appropriate clone.
connection.settings_dict.update(settings_dict)
connection.close() connection.close()