移除缓存包
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"ems.agt/lib/cache"
|
||||
"ems.agt/lib/log"
|
||||
"github.com/shirou/gopsutil/v3/host"
|
||||
"github.com/shirou/gopsutil/v3/net"
|
||||
@@ -115,12 +114,6 @@ func ProcessData(c *Client, inputMsg []byte) {
|
||||
return
|
||||
}
|
||||
switch wsInput.Type {
|
||||
case "wget":
|
||||
res, err := getDownloadProcess(wsInput.DownloadProgress)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
c.Msg <- res
|
||||
case "ps":
|
||||
res, err := getProcessData(wsInput.PsProcessConfig)
|
||||
if err != nil {
|
||||
@@ -150,22 +143,6 @@ type Process struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func getDownloadProcess(progress DownloadProgress) (res []byte, err error) {
|
||||
var result []Process
|
||||
for _, k := range progress.Keys {
|
||||
value, err := cache.CACHE.Get(k)
|
||||
if err != nil {
|
||||
log.Errorf("get cache error,err %s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
downloadProcess := &Process{}
|
||||
_ = json.Unmarshal(value, downloadProcess)
|
||||
result = append(result, *downloadProcess)
|
||||
}
|
||||
res, err = json.Marshal(result)
|
||||
return
|
||||
}
|
||||
|
||||
const (
|
||||
b = uint64(1)
|
||||
kb = 1024 * b
|
||||
|
||||
Reference in New Issue
Block a user