Replaced db.flush with db.commit

To try fix some odd cases of greenlet whining
This commit is contained in:
Donkie
2023-08-28 20:31:25 +02:00
parent e6b30da55d
commit 6e7d9a2e03
3 changed files with 9 additions and 9 deletions

View File

@@ -59,7 +59,7 @@ async def create(
archived=archived,
)
db.add(db_item)
await db.flush()
await db.commit()
return db_item
@@ -140,7 +140,7 @@ async def update(
setattr(spool, k, utc_timezone_naive(v))
else:
setattr(spool, k, v)
await db.flush()
await db.commit()
return spool
@@ -192,7 +192,7 @@ async def use_weight(db: AsyncSession, spool_id: int, weight: float) -> models.S
spool.first_used = datetime.utcnow()
spool.last_used = datetime.utcnow()
await db.flush()
await db.commit()
return spool
@@ -236,5 +236,5 @@ async def use_length(db: AsyncSession, spool_id: int, length: float) -> models.S
spool.first_used = datetime.utcnow()
spool.last_used = datetime.utcnow()
await db.flush()
await db.commit()
return spool