MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / SaveProcess

Method SaveProcess

agent/utils/files/file_op.go:390–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

388}
389
390func (w *WriteCounter) SaveProcess() {
391 percentValue := 0.0
392 if w.Total > 0 {
393 percent := float64(w.Written) / float64(w.Total) * 100
394 percentValue, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", percent), 64)
395 }
396 process := Process{
397 Total: w.Total,
398 Written: w.Written,
399 Percent: percentValue,
400 Name: w.Name,
401 }
402 by, _ := json.Marshal(process)
403 if percentValue < 100 {
404 global.CACHE.Set(w.Key, string(by))
405 } else {
406 global.CACHE.SetWithTTL(w.Key, string(by), time.Second*time.Duration(10))
407 }
408}
409
410func buildDownloadProxyURL(proxy DownloadProxyConfig) (*url.URL, error) {
411 proxyType := strings.TrimSpace(proxy.Type)

Callers 1

WriteMethod · 0.95

Calls 2

SetWithTTLMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected