Move DB writes to background thread and add SVG icon
Record usage in a daemon thread to avoid blocking the event loop with SQLite fsync on slow storage. Replace text button label with a bar-chart-with-nodes SVG icon in the legacy menu fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from aiohttp import web
|
||||
from server import PromptServer
|
||||
@@ -25,7 +26,11 @@ def on_prompt_handler(json_data):
|
||||
if ct:
|
||||
class_types.add(ct)
|
||||
if class_types:
|
||||
tracker.record_usage(class_types, mapper)
|
||||
threading.Thread(
|
||||
target=tracker.record_usage,
|
||||
args=(class_types, mapper),
|
||||
daemon=True,
|
||||
).start()
|
||||
except Exception:
|
||||
logger.warning("nodes-stats: error recording usage", exc_info=True)
|
||||
return json_data
|
||||
|
||||
Reference in New Issue
Block a user