|
@ -158,14 +158,17 @@ class ServerManager(util.LoggedClass): |
|
|
item = (priority, self.next_queue_id, session) |
|
|
item = (priority, self.next_queue_id, session) |
|
|
self.next_queue_id += 1 |
|
|
self.next_queue_id += 1 |
|
|
|
|
|
|
|
|
secs = int(session.pause) |
|
|
excess = max(0, priority - self.BANDS) |
|
|
excess = priority - self.BANDS |
|
|
if excess != session.last_delay: |
|
|
if excess > 0: |
|
|
session.last_delay = excess |
|
|
secs = excess |
|
|
if excess: |
|
|
session.log_info('delaying response to low-priority session {:d}s' |
|
|
session.log_info('high bandwidth use, deprioritizing by ' |
|
|
.format(secs)) |
|
|
'delaying responses {:d}s'.format(excess)) |
|
|
if secs: |
|
|
else: |
|
|
self.delayed_sessions.append((time.time() + secs, item)) |
|
|
session.log_info('stopped delaying responses') |
|
|
|
|
|
delay = max(int(session.pause), excess) |
|
|
|
|
|
if delay: |
|
|
|
|
|
self.delayed_sessions.append((time.time() + delay, item)) |
|
|
else: |
|
|
else: |
|
|
self.queue.put_nowait(item) |
|
|
self.queue.put_nowait(item) |
|
|
|
|
|
|
|
@ -573,6 +576,7 @@ class Session(JSONRPC): |
|
|
self.anon_logs = env.anon_logs |
|
|
self.anon_logs = env.anon_logs |
|
|
self.max_send = env.max_send |
|
|
self.max_send = env.max_send |
|
|
self.bandwidth_limit = env.bandwidth_limit |
|
|
self.bandwidth_limit = env.bandwidth_limit |
|
|
|
|
|
self.last_delay = 0 |
|
|
self.txs_sent = 0 |
|
|
self.txs_sent = 0 |
|
|
self.requests = [] |
|
|
self.requests = [] |
|
|
|
|
|
|
|
|