handle lock inside goroutine

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
mudler
2025-03-25 18:48:15 +01:00
parent e26b55a6a8
commit ddc7d0e100

View File

@@ -196,6 +196,10 @@ func (t *Slack) handleChannelMessage(
currentConv := t.conversationTracker.GetConversation(t.channelID)
message := replaceUserIDsWithNamesInMessage(api, cleanUpUsernameFromMessage(ev.Text, b))
go func() {
// Lock the conversation mutex to update the conversation history
t.processing.Lock()
@@ -214,10 +218,6 @@ func (t *Slack) handleChannelMessage(
t.processing.Unlock()
}()
message := replaceUserIDsWithNamesInMessage(api, cleanUpUsernameFromMessage(ev.Text, b))
go func() {
imageBytes := new(bytes.Buffer)
mimeType := "image/jpeg"