Caching will now be used from libbot
This commit is contained in:
@@ -2,9 +2,6 @@ from typing import Dict, Any
|
||||
|
||||
from async_pymongo import AsyncClient, AsyncCollection, AsyncDatabase
|
||||
from libbot.utils import config_get
|
||||
from pymongo import MongoClient
|
||||
from pymongo.synchronous.collection import Collection
|
||||
from pymongo.synchronous.database import Database
|
||||
|
||||
db_config: Dict[str, Any] = config_get("database")
|
||||
|
||||
@@ -23,7 +20,6 @@ con_string: str = (
|
||||
)
|
||||
|
||||
db_client: AsyncClient = AsyncClient(con_string)
|
||||
db_client_sync: MongoClient = MongoClient(con_string)
|
||||
|
||||
# Async declarations per default
|
||||
db: AsyncDatabase = db_client.get_database(name=db_config["name"])
|
||||
@@ -31,11 +27,5 @@ db: AsyncDatabase = db_client.get_database(name=db_config["name"])
|
||||
col_users: AsyncCollection = db.get_collection("users")
|
||||
col_analytics: AsyncCollection = db.get_collection("analytics")
|
||||
|
||||
# Sync declarations as a fallback
|
||||
sync_db: Database = db_client_sync.get_database(name=db_config["name"])
|
||||
|
||||
sync_col_users: Collection = sync_db.get_collection("users")
|
||||
sync_col_analytics: Collection = sync_db.get_collection("analytics")
|
||||
|
||||
# Update indexes
|
||||
sync_col_users.create_index(["id"], unique=True)
|
||||
db.dispatch.get_collection("users").create_index("id", unique=True)
|
||||
|
Reference in New Issue
Block a user