MCPcopy
hub / github.com/wavetermdev/waveterm / setTermSizeInDB

Function setTermSizeInDB

pkg/blockcontroller/shellcontroller.go:893–912  ·  view source on GitHub ↗
(blockId string, termSize waveobj.TermSize)

Source from the content-addressed store, hash-verified

891}
892
893func setTermSizeInDB(blockId string, termSize waveobj.TermSize) error {
894 ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
895 defer cancelFn()
896 ctx = waveobj.ContextWithUpdates(ctx)
897 bdata, err := wstore.DBMustGet[*waveobj.Block](ctx, blockId)
898 if err != nil {
899 return fmt.Errorf("error getting block data: %v", err)
900 }
901 if bdata.RuntimeOpts == nil {
902 bdata.RuntimeOpts = &waveobj.RuntimeOpts{}
903 }
904 bdata.RuntimeOpts.TermSize = termSize
905 err = wstore.DBUpdate(ctx, bdata)
906 if err != nil {
907 return fmt.Errorf("error updating block data: %v", err)
908 }
909 updates := waveobj.ContextGetUpdatesRtn(ctx)
910 wps.Broker.SendUpdateEvents(updates)
911 return nil
912}

Callers 1

updateTermSizeFunction · 0.85

Calls 5

ContextWithUpdatesFunction · 0.92
DBMustGetFunction · 0.92
DBUpdateFunction · 0.92
ContextGetUpdatesRtnFunction · 0.92
SendUpdateEventsMethod · 0.80

Tested by

no test coverage detected