Closed caches in clear_cache_handlers() signal handler.

This also fixes ResourceWarnings about unclosed sockets emitted in
cache.tests.
This commit is contained in:
Jon Dufresne 2020-02-06 23:03:25 -08:00 committed by GitHub
parent 3259983f56
commit 9cc743d0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,8 @@ COMPLEX_OVERRIDE_SETTINGS = {'DATABASES'}
@receiver(setting_changed)
def clear_cache_handlers(**kwargs):
if kwargs['setting'] == 'CACHES':
from django.core.cache import caches
from django.core.cache import caches, close_caches
close_caches()
caches._caches = Local()