fix delete_existing for _persist_events (#6300)
this is part of _retry_on_integrity_error, so should only be on _persist_events_and_state_updates
This commit is contained in:
parent
b7fe62b766
commit
0467f33584
|
@ -0,0 +1 @@
|
||||||
|
Move `persist_events` out from main data store.
|
|
@ -82,7 +82,7 @@ def _retry_on_integrity_error(func):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def f(self, *args, **kwargs):
|
def f(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
res = yield func(self, *args, **kwargs)
|
res = yield func(self, *args, delete_existing=False, **kwargs)
|
||||||
except self.database_engine.module.IntegrityError:
|
except self.database_engine.module.IntegrityError:
|
||||||
logger.exception("IntegrityError, retrying.")
|
logger.exception("IntegrityError, retrying.")
|
||||||
res = yield func(self, *args, delete_existing=True, **kwargs)
|
res = yield func(self, *args, delete_existing=True, **kwargs)
|
||||||
|
|
|
@ -260,9 +260,7 @@ class EventsPersistenceStorage(object):
|
||||||
self._event_persist_queue.handle_queue(room_id, persisting_queue)
|
self._event_persist_queue.handle_queue(room_id, persisting_queue)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _persist_events(
|
def _persist_events(self, events_and_contexts, backfilled=False):
|
||||||
self, events_and_contexts, backfilled=False, delete_existing=False
|
|
||||||
):
|
|
||||||
"""Calculates the change to current state and forward extremities, and
|
"""Calculates the change to current state and forward extremities, and
|
||||||
persists the given events and with those updates.
|
persists the given events and with those updates.
|
||||||
|
|
||||||
|
@ -412,7 +410,6 @@ class EventsPersistenceStorage(object):
|
||||||
state_delta_for_room=state_delta_for_room,
|
state_delta_for_room=state_delta_for_room,
|
||||||
new_forward_extremeties=new_forward_extremeties,
|
new_forward_extremeties=new_forward_extremeties,
|
||||||
backfilled=backfilled,
|
backfilled=backfilled,
|
||||||
delete_existing=delete_existing,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in New Issue