Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add timestamp to execution messages (#4076)

Chenlei Hu5b69cfe7c343
diff --git a/execution.py b/execution.py
index 8b3d116c6..0a2e62e7e 100644
--- a/execution.py
+++ b/execution.py
@@ -3,6 +3,7 @@ import copy
import logging
import threading
import heapq
+import time
import traceback
import inspect
from typing import List, Literal, NamedTuple, Optional
@@ -283,7 +284,11 @@ class PromptExecutor:
self.success = True
self.old_prompt = {}
- def add_message(self, event, data, broadcast: bool):
+ def add_message(self, event, data: dict, broadcast: bool):
+ data = {
+ **data,
+ "timestamp": int(time.time() * 1000),
+ }
self.status_messages.append((event, data))
if self.server.client_id is not None or broadcast:
self.server.send_sync(event, data, self.server.client_id)
@@ -394,6 +399,9 @@ class PromptExecutor:
if self.success is not True:
self.handle_execution_error(prompt_id, prompt, current_outputs, executed, error, ex)
break
+ else:
+ # Only execute when the while-loop ends without break
+ self.add_message("execution_success", { "prompt_id": prompt_id }, broadcast=False)
for x in executed:
self.old_prompt[x] = copy.deepcopy(prompt[x])