mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
Additional Demo Fixes (#191)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user