changed MinerFactory to a singleton class to ensure clearing its cache is easier and removed creation of independant miner factories for each utility
This commit is contained in:
@@ -37,9 +37,19 @@ from settings import MINER_FACTORY_GET_VERSION_RETRIES as GET_VERSION_RETRIES
|
||||
|
||||
|
||||
class MinerFactory:
|
||||
_instance = None
|
||||
|
||||
def __init__(self):
|
||||
self.miners = {}
|
||||
|
||||
def __new__(cls):
|
||||
if not cls._instance:
|
||||
cls._instance = super(
|
||||
MinerFactory,
|
||||
cls
|
||||
).__new__(cls)
|
||||
return cls._instance
|
||||
|
||||
async def get_miner_generator(self, ips: list):
|
||||
"""
|
||||
Get Miner objects from ip addresses using an async generator.
|
||||
|
||||
Reference in New Issue
Block a user