Send NumRunningCommands updates via the main bus, regardless of where other updates are being sent (#545)

This commit is contained in:
Evan Simkowitz 2024-04-02 18:47:54 -07:00 committed by GitHub
parent ccc63937b6
commit a139633375
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -2939,7 +2939,7 @@ func OpenAICommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus
return nil, fmt.Errorf("openai error, prompt string is blank")
}
update := scbus.MakeUpdatePacket()
sstore.IncrementNumRunningCmds_Update(update, cmd.ScreenId, 1)
go sstore.IncrementNumRunningCmds(cmd.ScreenId, 1)
line, err := sstore.AddOpenAILine(ctx, ids.ScreenId, DefaultUserId, cmd)
if err != nil {
return nil, fmt.Errorf("cannot add new line: %v", err)
@ -3148,7 +3148,7 @@ func addLineForCmd(ctx context.Context, metaCmd string, shouldFocus bool, ids re
sstore.AddLineUpdate(update, rtnLine, cmd)
update.AddUpdate(*screen)
if cmd.Status == sstore.CmdStatusRunning {
sstore.IncrementNumRunningCmds_Update(update, cmd.ScreenId, 1)
go sstore.IncrementNumRunningCmds(cmd.ScreenId, 1)
}
updateHistoryContext(ctx, rtnLine, cmd, cmd.FeState)
return update, nil

View File

@ -789,7 +789,7 @@ func UpdateCmdDoneInfo(ctx context.Context, update *scbus.ModelUpdatePacketType,
// This is not a fatal error, so just log it
log.Printf("error setting status indicator level after done packet: %v\n", err)
}
IncrementNumRunningCmds_Update(update, screenId, -1)
go IncrementNumRunningCmds(screenId, -1)
return nil
}