add arg for db path

This commit is contained in:
Victor Shyba 2022-07-21 15:52:19 -03:00 committed by Victor Shyba
parent 43b45a939b
commit 9aa9ecdc0a

View file

@ -1,3 +1,4 @@
import sys
import datetime import datetime
import logging import logging
import asyncio import asyncio
@ -457,12 +458,13 @@ def dict_row_factory(cursor, row):
async def test(): async def test():
db_path = "/tmp/peers.db" if len(sys.argv) == 1 else sys.argv[-1]
asyncio.get_event_loop().set_debug(True) asyncio.get_event_loop().set_debug(True)
metrics = SimpleMetrics('8080') metrics = SimpleMetrics('8080')
await metrics.start() await metrics.start()
conf = Config() conf = Config()
hosting_samples = SDHashSamples("test.sample") if os.path.isfile("test.sample") else None hosting_samples = SDHashSamples("test.sample") if os.path.isfile("test.sample") else None
crawler = Crawler("/tmp/a.db", hosting_samples) crawler = Crawler(db_path, hosting_samples)
await crawler.open() await crawler.open()
await crawler.flush_to_db() await crawler.flush_to_db()
await crawler.node.start_listening() await crawler.node.start_listening()