Additional Demo Fixes (#191)

This commit is contained in:
Sylvie Crowe
2024-08-01 00:57:06 -07:00
committed by GitHub
parent 49a365e10b
commit 7cba3c46d4
8 changed files with 32 additions and 5 deletions
+2 -1
View File
@@ -232,7 +232,8 @@ type OpenAIUsageType struct {
}
type CpuDataRequest struct {
Id string `json:"id"`
Id string `json:"id"`
Count int `json:"count"`
}
type CpuDataType struct {
+11
View File
@@ -97,6 +97,17 @@ func (ws *WshServer) StreamCpuDataCommand(ctx context.Context, request wshrpc.Cp
rtn <- wshrpc.RespOrErrorUnion[wshrpc.CpuDataType]{Error: err}
return
}
blockData, getBlockDataErr := wstore.DBMustGet[*wstore.Block](ctx, request.Id)
if getBlockDataErr != nil {
rtn <- wshrpc.RespOrErrorUnion[wshrpc.CpuDataType]{Error: getBlockDataErr}
return
}
count := blockData.Meta.GetInt(wstore.MetaKey_Count, 0)
if count != request.Count {
rtn <- wshrpc.RespOrErrorUnion[wshrpc.CpuDataType]{Error: fmt.Errorf("new instance created. canceling old goroutine")}
return
}
}
}()