summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/core/cache/backends/db.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index eb459a076d..1853db097f 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -65,7 +65,7 @@ class CacheClass(BaseCache):
cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)])
except DatabaseError:
# To be threadsafe, updates/inserts are allowed to fail silently
- transaction.rollback()
+ transaction.rollback_unless_managed()
return False
else:
transaction.commit_unless_managed()