Update pkg/channels/wecom/aibot.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
aa9ce6955b
commit
0b6d913dfc
1 changed files with 3 additions and 0 deletions
|
|
@ -181,6 +181,9 @@ func (c *WeComAIBotChannel) Stop(ctx context.Context) error {
|
||||||
// It writes into the earliest unfinished task in the queue (FIFO per chatID).
|
// It writes into the earliest unfinished task in the queue (FIFO per chatID).
|
||||||
// If the stream has already closed (deadline passed), it posts directly to response_url.
|
// If the stream has already closed (deadline passed), it posts directly to response_url.
|
||||||
func (c *WeComAIBotChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
|
func (c *WeComAIBotChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
|
||||||
|
if !c.IsRunning() {
|
||||||
|
return channels.ErrNotRunning
|
||||||
|
}
|
||||||
c.taskMu.Lock()
|
c.taskMu.Lock()
|
||||||
queue := c.chatTasks[msg.ChatID]
|
queue := c.chatTasks[msg.ChatID]
|
||||||
for len(queue) > 0 && queue[0].Finished {
|
for len(queue) > 0 && queue[0].Finished {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue