mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Count and loop
This commit is contained in:
parent
96c5b9f87c
commit
142934084a
@ -301,7 +301,7 @@ class SQLBaseStore(object):
|
||||
|
||||
self._event_fetch_lock = threading.Lock()
|
||||
self._event_fetch_list = []
|
||||
self._event_fetch_ongoing = False
|
||||
self._event_fetch_ongoing = 0
|
||||
|
||||
self.database_engine = hs.database_engine
|
||||
|
||||
|
@ -506,6 +506,7 @@ class EventsStore(SQLBaseStore):
|
||||
|
||||
def do_fetch(txn):
|
||||
event_list = []
|
||||
while True:
|
||||
try:
|
||||
with self._event_fetch_lock:
|
||||
event_list = self._event_fetch_list
|
||||
@ -538,9 +539,6 @@ class EventsStore(SQLBaseStore):
|
||||
reactor.callFromThread(d.errback, e)
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
with self._event_fetch_lock:
|
||||
self._event_fetch_ongoing = False
|
||||
|
||||
def cb(rows):
|
||||
return defer.gatherResults([
|
||||
@ -561,12 +559,12 @@ class EventsStore(SQLBaseStore):
|
||||
(events, d)
|
||||
)
|
||||
|
||||
if not self._event_fetch_ongoing:
|
||||
if self._event_fetch_ongoing < 3:
|
||||
self._event_fetch_ongoing += 1
|
||||
self.runInteraction(
|
||||
"do_fetch",
|
||||
do_fetch
|
||||
)
|
||||
self._event_fetch_ongoing = True
|
||||
|
||||
res = yield d
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user