make async db calls

pull/22/head
lza_menace 2 years ago
parent cd1e587ee1
commit 3d565f3c8d

@ -314,7 +314,7 @@ def validate():
@app.cli.command("export") @app.cli.command("export")
def export(): def export():
all_nodes = [] all_nodes = []
ts = int(arrow.get().timestamp()) ts = int(arrow.get().timestamp)
export_dir = f"{config.DATA_DIR}/export.txt" export_dir = f"{config.DATA_DIR}/export.txt"
export_dir_stamped = f"{config.DATA_DIR}/export-{ts}.txt" export_dir_stamped = f"{config.DATA_DIR}/export-{ts}.txt"
nodes = Node.select().where(Node.validated == True) nodes = Node.select().where(Node.validated == True)

@ -2,11 +2,12 @@ from urllib.parse import urlparse
from datetime import datetime from datetime import datetime
from peewee import * from peewee import *
from playhouse.sqliteq import SqliteQueueDatabase
from xmrnodes import config from xmrnodes import config
db = SqliteDatabase(f"{config.DATA_DIR}/sqlite.db") db = SqliteQueueDatabase(f"{config.DATA_DIR}/sqlite.db")
class Node(Model): class Node(Model):
id = AutoField() id = AutoField()

Loading…
Cancel
Save