1
0
Fork 0

Fixing some db issues

This commit is contained in:
Ethanell 2020-11-06 18:03:09 +01:00
parent 82e92e457c
commit 404cf8b97a
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,11 @@ from administrator.config import config
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine(config.get("db"))
db = config.get("db")
args = {"pool_pre_ping": True, "pool_recycle": 3600}
if not db.startswith("sqlite:"):
args.update({"pool_size": 0, "max_overflow": -1})
engine = create_engine(db, **args)
Session = sessionmaker(bind=engine)
Base = declarative_base()
from db.Task import Task

View file

@ -87,6 +87,7 @@ class RoRec(commands.Cog):
s = db.Session()
s.add(r)
s.commit()
s.close()
await ctx.message.add_reaction("\U0001f44d")
@rorec.group("edit", pass_context=True)