getdata performance optimisation

- reduce number of calls to time.time()
- no need to shuffle, that's done by the upload thread
- get rid of unused import
This commit is contained in:
Peter Šurda 2018-12-19 09:38:38 +01:00
parent ca567acab3
commit 3a4eed0f8b
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -26,7 +26,6 @@ from queues import objectProcessorQueue, portCheckerQueue, invQueue, addrQueue
import shared
import state
import protocol
import helper_random
class BMProtoError(ProxyError):
errorCodes = ("Protocol error")
@ -280,11 +279,11 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
def bm_command_getdata(self):
items = self.decode_payload_content("l32s")
# skip?
if time.time() < self.skipUntil:
now = time.time()
if now < self.skipUntil:
return True
for i in map(str, items):
self.pendingUpload[i] = time.time()
self.pendingUpload[i] = now
return True
def _command_inv(self, dandelion=False):