diff --git a/execution.py b/execution.py index 17dc7c5a299..7ca96496b1f 100644 --- a/execution.py +++ b/execution.py @@ -810,17 +810,21 @@ def get_queue_position_per_client(self): pending_clients = [] with self.mutex: for item in self.queue: - pending_clients.append([item[3]['client_id'], item[0]]) + print(item) + pending_clients.append( + [item[3]['client_id'], item[0], item[1]]) + # [client_id, numer_in_queue, prompt_id] pending_clients.sort(key=lambda i: i[1]) positions = dict() for index, item in enumerate(pending_clients): if item[0] not in positions: - positions[item[0]] = [index + 1] + positions[item[0]] = [[index + 1, item[2]]] else: - positions[item[0]].append(index + 1) + positions[item[0]].append([index + 1, item[2]]) + # client_id: [[number_in_queue, prompt_id], ...] return positions def wipe_queue(self): diff --git a/server.py b/server.py index 617901c1b53..9974a0682be 100644 --- a/server.py +++ b/server.py @@ -697,7 +697,8 @@ def queue_updated(self): return for sid, positions in pending_clients.items(): - self.send_sync("queue", {"remaining": positions[0]}, sid) + self.send_sync( + "queue", {"remaining": positions[0][0], "prompt_id": positions[0][1]}, sid) async def publish_loop(self): while True: