Parrellize fetching of events
This commit is contained in:
parent
963256638d
commit
58d848adc0
1 changed files with 11 additions and 3 deletions
|
@ -50,8 +50,11 @@ class FederationBase(object):
|
|||
Returns:
|
||||
Deferred : A list of PDUs that have valid signatures and hashes.
|
||||
"""
|
||||
|
||||
signed_pdus = []
|
||||
for pdu in pdus:
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def do(pdu):
|
||||
try:
|
||||
new_pdu = yield self._check_sigs_and_hash(pdu)
|
||||
signed_pdus.append(new_pdu)
|
||||
|
@ -66,7 +69,7 @@ class FederationBase(object):
|
|||
)
|
||||
if new_pdu:
|
||||
signed_pdus.append(new_pdu)
|
||||
continue
|
||||
return
|
||||
|
||||
# Check pdu.origin
|
||||
if pdu.origin != origin:
|
||||
|
@ -79,12 +82,17 @@ class FederationBase(object):
|
|||
|
||||
if new_pdu:
|
||||
signed_pdus.append(new_pdu)
|
||||
continue
|
||||
return
|
||||
except:
|
||||
pass
|
||||
|
||||
logger.warn("Failed to find copy of %s with valid signature")
|
||||
|
||||
yield defer.gatherResults(
|
||||
[do(pdu) for pdu in pdus],
|
||||
consumeErrors=True
|
||||
)
|
||||
|
||||
defer.returnValue(signed_pdus)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
Loading…
Reference in a new issue