Skip to content

Commit 2e8ade8

Browse files
fix(scheduler): propagate status_tracker via setter to ensure proper initialization
1 parent f5b009e commit 2e8ade8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/memos/mem_scheduler/base_scheduler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ def initialize_modules(
224224
if self.dispatcher:
225225
self.dispatcher.status_tracker = self.status_tracker
226226
if self.memos_message_queue:
227-
self.memos_message_queue.status_tracker = self.status_tracker
227+
# Use the setter to propagate to the inner queue (e.g. SchedulerRedisQueue)
228+
self.memos_message_queue.set_status_tracker(self.status_tracker)
228229
# initialize submodules
229230
self.chat_llm = chat_llm
230231
self.process_llm = process_llm

src/memos/mem_scheduler/task_schedule_modules/task_queue.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ def __init__(
4949

5050
self.disabled_handlers = disabled_handlers
5151

52+
def set_status_tracker(self, status_tracker: TaskStatusTracker) -> None:
53+
"""
54+
Set the status tracker for this queue and propagate it to the underlying queue implementation.
55+
56+
This allows the tracker to be injected after initialization (e.g., when Redis connection becomes available).
57+
"""
58+
self.status_tracker = status_tracker
59+
if self.memos_message_queue and hasattr(self.memos_message_queue, "status_tracker"):
60+
# SchedulerRedisQueue has status_tracker attribute (from our previous fix)
61+
# SchedulerLocalQueue can also accept it dynamically if it doesn't use __slots__
62+
self.memos_message_queue.status_tracker = status_tracker
63+
logger.info("Propagated status_tracker to underlying message queue")
64+
5265
def ack_message(
5366
self,
5467
user_id: str,

0 commit comments

Comments
 (0)