perf(cron): use read lock for concurrent reads in addJob
This commit is contained in:
parent
4f3495d969
commit
ab1125f622
1 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
func (t *CronTool) addJob(args map[string]interface{}) *ToolResult {
|
||||||
t.mu.Lock()
|
t.mu.RLock()
|
||||||
channel := t.channel
|
channel := t.channel
|
||||||
chatID := t.chatID
|
chatID := t.chatID
|
||||||
t.mu.Unlock()
|
t.mu.RUnlock()
|
||||||
|
|
||||||
if channel == "" || chatID == "" {
|
if channel == "" || chatID == "" {
|
||||||
return ErrorResult("no session context (channel/chat_id not set). Use this tool in an active conversation.")
|
return ErrorResult("no session context (channel/chat_id not set). Use this tool in an active conversation.")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue