fix: storeThought orphaned lock → defer unlock
This commit is contained in:
@@ -1895,6 +1895,7 @@ func (t *Thinker) buildOpenAITools() []llm.OpenAITool {
|
||||
// storeThought 存储思考结果到待推送队列,并异步持久化到 memory-service
|
||||
func (t *Thinker) storeThought(content string, toolCallsJSON string, toolCallCount int) {
|
||||
t.muLock()
|
||||
defer t.muUnlock()
|
||||
t.pendingThoughts = append(t.pendingThoughts, &PendingThought{
|
||||
Content: content,
|
||||
CreatedAt: time.Now(),
|
||||
@@ -1951,7 +1952,6 @@ func (t *Thinker) storeThought(content string, toolCallsJSON string, toolCallCou
|
||||
copy := *proactiveTarget
|
||||
targetCopy = ©
|
||||
}
|
||||
t.muUnlock()
|
||||
|
||||
log.Printf("[后台思考] 思考已存储 (当前累积 %d 条待推送思考)", len(t.pendingThoughts))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user