diff options
| author | Barthelemy Dagenais <barthelemy@infobart.com> | 2016-05-17 10:54:57 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-18 09:13:21 -0400 |
| commit | 47da073cb01f86f6f71cf19a2866f80a9755f434 (patch) | |
| tree | f5b76533d7999945835a55065b0c323414047c3c /django | |
| parent | ff1eb0a6deeab6b07f30f11b2a6565ae9ec5556b (diff) | |
[1.9.x] Fixed #26627 -- Fixed on_commit callbacks execution order when callbacks make transactions.
Backport of a5c8072ab1e56da368a40f3e9c9a3b465f4ffbae from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/base.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py index 0356ab54cc..021fe0bafa 100644 --- a/django/db/backends/base/base.py +++ b/django/db/backends/base/base.py @@ -617,12 +617,11 @@ class BaseDatabaseWrapper(object): def run_and_clear_commit_hooks(self): self.validate_no_atomic_block() - try: - while self.run_on_commit: - sids, func = self.run_on_commit.pop(0) - func() - finally: - self.run_on_commit = [] + current_run_on_commit = self.run_on_commit + self.run_on_commit = [] + while current_run_on_commit: + sids, func = current_run_on_commit.pop(0) + func() def copy(self, alias=None, allow_thread_sharing=None): """ |
