mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
sql_db: do not require network object
This commit is contained in:
parent
82da581d45
commit
c454564ed6
2 changed files with 4 additions and 4 deletions
|
@ -242,7 +242,7 @@ class ChannelDB(SqlDB):
|
|||
|
||||
def __init__(self, network: 'Network'):
|
||||
path = os.path.join(get_headers_dir(network.config), 'gossip_db')
|
||||
super().__init__(network, path, commit_interval=100)
|
||||
super().__init__(network.asyncio_loop, path, commit_interval=100)
|
||||
self.lock = threading.RLock()
|
||||
self.num_nodes = 0
|
||||
self.num_channels = 0
|
||||
|
|
|
@ -19,9 +19,9 @@ def sql(func):
|
|||
|
||||
class SqlDB(Logger):
|
||||
|
||||
def __init__(self, network, path, commit_interval=None):
|
||||
def __init__(self, asyncio_loop, path, commit_interval=None):
|
||||
Logger.__init__(self)
|
||||
self.network = network
|
||||
self.asyncio_loop = asyncio_loop
|
||||
self.path = path
|
||||
self.commit_interval = commit_interval
|
||||
self.db_requests = queue.Queue()
|
||||
|
@ -34,7 +34,7 @@ class SqlDB(Logger):
|
|||
self.logger.info("Creating database")
|
||||
self.create_database()
|
||||
i = 0
|
||||
while self.network.asyncio_loop.is_running():
|
||||
while self.asyncio_loop.is_running():
|
||||
try:
|
||||
future, func, args, kwargs = self.db_requests.get(timeout=0.1)
|
||||
except queue.Empty:
|
||||
|
|
Loading…
Add table
Reference in a new issue