More decoupling, removed unnecessary announceCache
This commit is contained in:
parent
fad5e8547e
commit
080f33bf1f
5 changed files with 10 additions and 12 deletions
|
@ -71,6 +71,7 @@ class OnionrCommunicatorDaemon:
|
|||
self.kv.put('dbTimestamps', {})
|
||||
self.kv.put('blocksToUpload', [])
|
||||
self.kv.put('cooldownPeer', {})
|
||||
self.kv.put('generating_blocks', [])
|
||||
|
||||
if config.get('general.offline_mode', False):
|
||||
self.isOnline = False
|
||||
|
@ -93,10 +94,6 @@ class OnionrCommunicatorDaemon:
|
|||
# list of peer's profiles (onionrpeers.PeerProfile instances)
|
||||
self.peerProfiles = []
|
||||
|
||||
self.announceProgress = {}
|
||||
|
||||
self.generating_blocks = []
|
||||
|
||||
# amount of threads running by name, used to prevent too many
|
||||
self.threadCounts = {}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ Remove block hash from daemon's upload list.
|
|||
"""
|
||||
from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from deadsimplekv import DeadSimpleKV
|
||||
from communicator import OnionrCommunicatorDaemon
|
||||
from onionrtypes import BlockHash
|
||||
"""
|
||||
|
@ -25,7 +26,8 @@ if TYPE_CHECKING:
|
|||
def remove_from_insert_queue(comm_inst: "OnionrCommunicatorDaemon",
|
||||
b_hash: "BlockHash"):
|
||||
"""Remove block hash from daemon's upload list."""
|
||||
kv: "DeadSimpleKV" = comm_inst.shared_state.get_by_string("DeadSimpleKV")
|
||||
try:
|
||||
comm_inst.generating_blocks.remove(b_hash)
|
||||
kv.get('generating_blocks').remove(b_hash)
|
||||
except ValueError:
|
||||
pass
|
||||
|
|
|
@ -25,8 +25,9 @@ if TYPE_CHECKING:
|
|||
|
||||
def clear_offline_peer(comm_inst: 'OnionrCommunicatorDaemon'):
|
||||
"""Remove the longest offline peer to retry later."""
|
||||
kv: "DeadSimpleKV" = comm_inst.shared_state.get_by_string("DeadSimpleKV")
|
||||
try:
|
||||
removed = comm_inst..pop(0)
|
||||
removed = kv.get('offlinePeers').pop(0)
|
||||
except IndexError:
|
||||
pass
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue