Skip to content

Commit

Permalink
Merge pull request #223 from XiaomaiTX/main
Browse files Browse the repository at this point in the history
fix: fix used of network error on forced shutdown
  • Loading branch information
XiaomaiTX authored Jul 2, 2024
2 parents 576213d + 0b13f57 commit 980bb2c
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions manager/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,15 @@ func createChatTask(
return
}

sendPackError := conn.SendClient(globals.ChatSegmentResponse{
if err := conn.SendClient(globals.ChatSegmentResponse{
Message: buffer.WriteChunk(data.Chunk),
Quota: buffer.GetQuota(),
End: false,
Plan: plan,
})
if sendPackError != nil {
globals.Warn(fmt.Sprintf("failed to send message to client: %s", sendPackError.Error()))
_ = conn.SendClient(globals.ChatSegmentResponse{
Message: sendPackError.Error(),
Quota: buffer.GetQuota(),
End: true,
Plan: plan,
})

interruptSignal <- sendPackError

return hit, sendPackError
}); err != nil {
globals.Warn(fmt.Sprintf("failed to send message to client: %s", err.Error()))
interruptSignal <- err
return hit, nil
}
case signal := <-stopSignal:
// if stop signal is received
Expand Down

0 comments on commit 980bb2c

Please sign in to comment.