The self.lock.__enter__()
looked suspicious without exiting, so I changed it to become the following and it rolled back as expected
with transaction.atomic(savepoint=True):
signals.task_started.send(sender=self.flow_class, process=self.process, task=self.task)
self.process.save()
lock_impl = self.flow_class.lock_impl(self.flow_class.instance)
self.lock = lock_impl(self.flow_class, self.process.pk)
# self.lock.__enter__()
with self.lock:
self.task.process = self.process
self.task.finished = now()
self.task.save()
signals.task_finished.send(sender=self.flow_class, process=self.process, task=self.task)
signals.flow_started.send(sender=self.flow_class, process=self.process, task=self.task)
self.activate_next()
@kmmbvnr can you please verify? Is there going to be any unintended consequences after this change?