@@ -61,18 +61,15 @@ class Database:
|
||||
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
|
||||
|
||||
connect_args = {}
|
||||
if self.connection_url.drivername == "sqlite":
|
||||
connect_args["check_same_thread"] = False
|
||||
elif self.connection_url.drivername == "postgresql":
|
||||
connect_args["options"] = "-c timezone=utc"
|
||||
connect_args["max_inactive_connection_lifetime"] = 3
|
||||
if self.connection_url.drivername == "sqlite+aiosqlite":
|
||||
connect_args["timeout"] = 60
|
||||
|
||||
self.engine = create_async_engine(
|
||||
self.connection_url,
|
||||
connect_args=connect_args,
|
||||
pool_pre_ping=True,
|
||||
)
|
||||
self.session_maker = async_sessionmaker(self.engine, autocommit=False, autoflush=True)
|
||||
self.session_maker = async_sessionmaker(self.engine, autocommit=False, autoflush=True, expire_on_commit=False)
|
||||
|
||||
|
||||
__db: Optional[Database] = None
|
||||
|
||||
@@ -561,7 +561,7 @@ async def test_use_spool_concurrent(random_filament: dict[str, Any]):
|
||||
spool = result.json()
|
||||
|
||||
# Execute
|
||||
requests = 20
|
||||
requests = 100
|
||||
used_weight = 0.5
|
||||
async with httpx.AsyncClient() as client:
|
||||
tasks = []
|
||||
|
||||
Reference in New Issue
Block a user