Asyncore getdata processing performance improvement
- no need to query DB for existence of each entry
This commit is contained in:
parent
fa56ab3e6f
commit
edcba9982b
|
@ -295,9 +295,10 @@ class BMConnection(TLSDispatcher, BMQueues):
|
||||||
if False:
|
if False:
|
||||||
self.antiIntersectionDelay()
|
self.antiIntersectionDelay()
|
||||||
else:
|
else:
|
||||||
if i in Inventory():
|
try:
|
||||||
self.append_write_buf(protocol.CreatePacket('object', Inventory()[i].payload))
|
self.append_write_buf(protocol.CreatePacket('object', Inventory()[i].payload))
|
||||||
else:
|
# this is faster than "if i in Inventory()"
|
||||||
|
except KeyError:
|
||||||
self.antiIntersectionDelay()
|
self.antiIntersectionDelay()
|
||||||
logger.warning('%s asked for an object with a getdata which is not in either our memory inventory or our SQL inventory. We probably cleaned it out after advertising it but before they got around to asking for it.' % (self.peer,))
|
logger.warning('%s asked for an object with a getdata which is not in either our memory inventory or our SQL inventory. We probably cleaned it out after advertising it but before they got around to asking for it.' % (self.peer,))
|
||||||
return True
|
return True
|
||||||
|
|
Reference in New Issue
Block a user