diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py
index 3ed9cf3..702d6b6 100644
a
|
b
|
class Loader(BaseLoader):
|
19 | 19 | def loaders(self): |
20 | 20 | # Resolve loaders on demand to avoid circular imports |
21 | 21 | if not self._cached_loaders: |
| 22 | # Note that it is important to set the self._cached_loaders only |
| 23 | # after all the self._loaders have been added to the list. |
| 24 | # Otherwise concurrent access to this property could see |
| 25 | # half-loaded _cached_loaders list. See #17303 for details. |
| 26 | cached_loaders = [] |
22 | 27 | for loader in self._loaders: |
23 | | self._cached_loaders.append(find_template_loader(loader)) |
| 28 | cached_loaders.append(find_template_loader(loader)) |
| 29 | self._cached_loaders = cached_loaders |
24 | 30 | return self._cached_loaders |
25 | 31 | |
26 | 32 | def find_template(self, name, dirs=None): |