Commit 7f070ed1 authored by Julien Muchembled's avatar Julien Muchembled Committed by Cédric Le Ninivin

Fix assertion failure when retrying to migrate a workflow history

When a first migration was reverted for any reason (e.g. ConflictError),
the assertion failed because __setstate__ was not called yet to fix the
class back to the old one.
parent 55ece350
...@@ -173,6 +173,8 @@ class TestWorkflowHistoryList(TestCase): ...@@ -173,6 +173,8 @@ class TestWorkflowHistoryList(TestCase):
self.checkClass(whl, WorkflowHistoryList) self.checkClass(whl, WorkflowHistoryList)
self.abort() self.abort()
self.assertEqual(len(whl), COUNT)
self.abort()
self.checkClass(whl, LegacyWorkflowHistoryList) self.checkClass(whl, LegacyWorkflowHistoryList)
self.assertEqual(len(whl), COUNT) self.assertEqual(len(whl), COUNT)
self.checkClass(whl, WorkflowHistoryList) self.checkClass(whl, WorkflowHistoryList)
......
...@@ -759,6 +759,7 @@ class WorkflowHistoryList(NewWorkflowHistoryList): ...@@ -759,6 +759,7 @@ class WorkflowHistoryList(NewWorkflowHistoryList):
stack = [self] stack = [self]
while True: while True:
stack.append(bucket) stack.append(bucket)
bucket._p_activate()
assert bucket.__class__ is WorkflowHistoryList, bucket.__class__ assert bucket.__class__ is WorkflowHistoryList, bucket.__class__
bucket.__class__ = NewWorkflowHistoryList bucket.__class__ = NewWorkflowHistoryList
bucket = bucket._prev bucket = bucket._prev
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment