Skip to content

Commit 568ff2c

Browse files
committed
Correctly report # of jobs in progress
1 parent 71a73b5 commit 568ff2c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class Stats(BaseModel):
237237
@app.get("/stats")
238238
async def stats() -> Stats:
239239
async with async_session() as session, session.begin():
240-
not_done = dict((await session.execute(select(Job.retry, sqlalchemy.func.count(Job.id)).where(Job.completed == None).group_by(Job.retry))).all())
240+
not_done = dict((await session.execute(select(Job.retry, sqlalchemy.func.count(Job.id)).where((Job.completed == None) & (Job.failed == None)).group_by(Job.retry))).all())
241241
completed = dict((await session.execute(select(Job.retry, sqlalchemy.func.count(Job.id)).where(Job.completed != None).group_by(Job.retry))).all())
242242
failed = (await session.scalar(select(sqlalchemy.func.count(Job.id)).where(Job.failed != None))) or 0
243243
batches = (await session.scalar(select(sqlalchemy.func.count(Batch.id)))) or 0

0 commit comments

Comments
 (0)