Closes WikiDeck/wikideck#6
This commit is contained in:
parent
8061fdba9b
commit
ea639eeac1
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
venv/*
|
venv/*
|
||||||
mine_data/*
|
mine_data/*
|
||||||
mariadb_data/*
|
mariadb_data/*
|
||||||
|
*.pem
|
||||||
|
*__pycache__*
|
||||||
|
|||||||
3
client-requirements.txt
Normal file
3
client-requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
cryptography
|
||||||
|
dotenv
|
||||||
|
wikipedia
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import datetime
|
import datetime
|
||||||
|
import logging
|
||||||
import mariadb
|
import mariadb
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@ -181,6 +182,8 @@ class Database():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
logging.basicConfig(filename=os.getenv('MINE_LOG_FILE', '/var/log/mine.log'), level=logging.INFO)
|
||||||
|
self.logger = logging.getLogger(__name__)
|
||||||
delay = 2
|
delay = 2
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@ -195,6 +198,7 @@ class Database():
|
|||||||
for each in self.SQL_CREATE_TABLES:
|
for each in self.SQL_CREATE_TABLES:
|
||||||
self.conn.cursor().execute(each)
|
self.conn.cursor().execute(each)
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
|
self.logger.error(e)
|
||||||
time.sleep(delay := delay**2)
|
time.sleep(delay := delay**2)
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user