From 3d565f3c8d34e96aeb9cf9c4b2b4dce4bbb9a15b Mon Sep 17 00:00:00 2001 From: lza_menace <lza_menace@protonmail.com> Date: Sun, 22 Jan 2023 20:07:03 -0800 Subject: [PATCH] make async db calls --- xmrnodes/app.py | 2 +- xmrnodes/models.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xmrnodes/app.py b/xmrnodes/app.py index 1523cd1..46473e4 100644 --- a/xmrnodes/app.py +++ b/xmrnodes/app.py @@ -314,7 +314,7 @@ def validate(): @app.cli.command("export") def export(): all_nodes = [] - ts = int(arrow.get().timestamp()) + ts = int(arrow.get().timestamp) export_dir = f"{config.DATA_DIR}/export.txt" export_dir_stamped = f"{config.DATA_DIR}/export-{ts}.txt" nodes = Node.select().where(Node.validated == True) diff --git a/xmrnodes/models.py b/xmrnodes/models.py index 32fb6bd..842ab46 100644 --- a/xmrnodes/models.py +++ b/xmrnodes/models.py @@ -2,11 +2,12 @@ from urllib.parse import urlparse from datetime import datetime from peewee import * +from playhouse.sqliteq import SqliteQueueDatabase from xmrnodes import config -db = SqliteDatabase(f"{config.DATA_DIR}/sqlite.db") +db = SqliteQueueDatabase(f"{config.DATA_DIR}/sqlite.db") class Node(Model): id = AutoField()