diff --git a/modules/progress.py b/modules/progress.py index f405f07fed2..b4ac5690f94 100644 --- a/modules/progress.py +++ b/modules/progress.py @@ -71,7 +71,12 @@ def progressapi(req: ProgressRequest): completed = req.id_task in finished_tasks if not active: - return ProgressResponse(active=active, queued=queued, completed=completed, id_live_preview=-1, textinfo="In queue..." if queued else "Waiting...") + textinfo = "Waiting..." + if queued: + sorted_queued = sorted(pending_tasks.keys(), key=lambda x: pending_tasks[x], reverse=True) + queue_index = sorted_queued.index(req.id_task) + textinfo = "In queue: {}/{}".format(queue_index + 1, len(sorted_queued)) + return ProgressResponse(active=active, queued=queued, completed=completed, id_live_preview=-1, textinfo=textinfo) progress = 0