From a139633375be31e2e49c21eea4ff848feea13a27 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 2 Apr 2024 18:47:54 -0700 Subject: [PATCH] Send NumRunningCommands updates via the main bus, regardless of where other updates are being sent (#545) --- wavesrv/pkg/cmdrunner/cmdrunner.go | 4 ++-- wavesrv/pkg/sstore/dbops.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 42cdca1f..62056e56 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -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 diff --git a/wavesrv/pkg/sstore/dbops.go b/wavesrv/pkg/sstore/dbops.go index 17e4b438..ca35f87a 100644 --- a/wavesrv/pkg/sstore/dbops.go +++ b/wavesrv/pkg/sstore/dbops.go @@ -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 }