Flush session once every 1000 records when bulk-deleting
This commit is contained in:
parent
46a43981df
commit
41e09271a2
|
@ -816,6 +816,8 @@ class MasterView(View):
|
||||||
|
|
||||||
def delete(obj, i):
|
def delete(obj, i):
|
||||||
session.delete(obj)
|
session.delete(obj)
|
||||||
|
if i % 1000 == 0:
|
||||||
|
session.flush()
|
||||||
|
|
||||||
self.progress_loop(delete, objects, progress,
|
self.progress_loop(delete, objects, progress,
|
||||||
message="Deleting objects")
|
message="Deleting objects")
|
||||||
|
|
Loading…
Reference in a new issue