From b59464230a2cf5be24227b56c05f752befd40369 Mon Sep 17 00:00:00 2001 From: yinwm Date: Fri, 13 Feb 2026 02:15:56 +0800 Subject: [PATCH] perf(cron): use read lock for concurrent reads in addJob --- pkg/tools/cron.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/tools/cron.go b/pkg/tools/cron.go index 5669271..3f2042e 100644 --- a/pkg/tools/cron.go +++ b/pkg/tools/cron.go @@ -122,10 +122,10 @@ func (t *CronTool) Execute(ctx context.Context, args map[string]interface{}) *To } func (t *CronTool) addJob(args map[string]interface{}) *ToolResult { - t.mu.Lock() + t.mu.RLock() channel := t.channel chatID := t.chatID - t.mu.Unlock() + t.mu.RUnlock() if channel == "" || chatID == "" { return ErrorResult("no session context (channel/chat_id not set). Use this tool in an active conversation.")