forked from LBRYCommunity/lbry-sdk
initialize new sessions with high priority
This commit is contained in:
parent
17eeafd62c
commit
6ec88e2101
1 changed files with 3 additions and 3 deletions
|
@ -891,13 +891,13 @@ class LBRYElectrumX(SessionBase):
|
||||||
self.daemon = self.session_mgr.daemon
|
self.daemon = self.session_mgr.daemon
|
||||||
self.bp: BlockProcessor = self.session_mgr.bp
|
self.bp: BlockProcessor = self.session_mgr.bp
|
||||||
self.db: LevelDB = self.bp.db
|
self.db: LevelDB = self.bp.db
|
||||||
self.time_since_last_request = time.perf_counter()
|
self.last_request_received_at = 0
|
||||||
|
|
||||||
def schedule_requests(self, requests):
|
def schedule_requests(self, requests):
|
||||||
for request in requests:
|
for request in requests:
|
||||||
current = time.perf_counter()
|
current = time.perf_counter()
|
||||||
elapsed = current - self.time_since_last_request
|
elapsed = current - self.last_request_received_at
|
||||||
self.time_since_last_request = current
|
self.last_request_received_at = current
|
||||||
self.session_mgr.priority_queue.put_nowait((elapsed, self._handle_request(request)))
|
self.session_mgr.priority_queue.put_nowait((elapsed, self._handle_request(request)))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Add table
Reference in a new issue