Skip to content

Commit 3b5f7ef

Browse files
committed
Merge branch 'genforma/master'
2 parents f27c1d1 + 5054645 commit 3b5f7ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

djcelery/snapshot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ def update_task(self, state, **kwargs):
129129

130130
return obj
131131

132+
@transaction.commit_manually
132133
def on_shutter(self, state, commit_every=100):
133-
if not state.event_count:
134+
if not state.event_count and transaction.is_dirty():
134135
transaction.commit()
135136
return
136137

@@ -143,6 +144,8 @@ def _handle_tasks():
143144
for worker in state.workers.items():
144145
self.handle_worker(worker)
145146
_handle_tasks()
147+
if transaction.is_dirty():
148+
transaction.commit()
146149

147150
def on_cleanup(self):
148151
expired = (self.TaskState.objects.expire_by_states(states, expires)

0 commit comments

Comments
 (0)