0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-10 20:11:32 +01:00
This commit is contained in:
Erik Johnston 2016-08-04 15:21:29 +01:00
parent 59fa91fe88
commit 8ad8490cff

View file

@ -163,7 +163,6 @@ def _retry_on_integrity_error(func):
def f(self, *args, **kwargs): def f(self, *args, **kwargs):
try: try:
res = yield func(self, *args, **kwargs) res = yield func(self, *args, **kwargs)
defer.returnValue(res)
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)
@ -577,6 +576,8 @@ class EventsStore(SQLBaseStore):
# This gets around any problems with some tables already having # This gets around any problems with some tables already having
# entries. # entries.
logger.info("Deleting existing")
for table in ( for table in (
"events", "events",
"event_json", "event_json",
@ -595,7 +596,7 @@ class EventsStore(SQLBaseStore):
): ):
txn.executemany( txn.executemany(
"DELETE FROM %s WHERE event_id = ?" % (table,), "DELETE FROM %s WHERE event_id = ?" % (table,),
[ev for ev, _ in events_and_contexts] [(ev.event_id,) for ev, _ in events_and_contexts]
) )
self._simple_insert_many_txn( self._simple_insert_many_txn(