added user images partitioning
This commit is contained in:
14
db/db.py
14
db/db.py
@@ -1,18 +1,10 @@
|
||||
# python
|
||||
import os
|
||||
from config.paths import get_database_dir
|
||||
import threading
|
||||
from tinydb import TinyDB
|
||||
|
||||
DB_ENV = os.environ.get('DB_ENV', 'prod')
|
||||
|
||||
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
if DB_ENV == 'prod':
|
||||
base_dir = os.path.join(project_root, 'data/db')
|
||||
else:
|
||||
base_dir = os.path.join(project_root, 'test_data/db')
|
||||
|
||||
base_dir = get_database_dir()
|
||||
os.makedirs(base_dir, exist_ok=True)
|
||||
|
||||
|
||||
@@ -95,7 +87,7 @@ reward_db = LockedTable(_reward_db)
|
||||
image_db = LockedTable(_image_db)
|
||||
pending_reward_db = LockedTable(_pending_rewards_db)
|
||||
|
||||
if DB_ENV == 'test':
|
||||
if os.environ.get('DB_ENV', 'prod') == 'test':
|
||||
child_db.truncate()
|
||||
task_db.truncate()
|
||||
reward_db.truncate()
|
||||
|
||||
Reference in New Issue
Block a user