From 6b4c7945196559d401ee2cca5b6a06e4fb02b514 Mon Sep 17 00:00:00 2001 From: hysyeah Date: Fri, 27 Dec 2024 13:18:19 +0800 Subject: [PATCH] fix: correct image download offset --- controllers/appmgr_controller.go | 15 +-------------- pkg/images/jobs.go | 2 +- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/controllers/appmgr_controller.go b/controllers/appmgr_controller.go index 9d57fd7..1b85ccf 100644 --- a/controllers/appmgr_controller.go +++ b/controllers/appmgr_controller.go @@ -970,20 +970,7 @@ func (r *ApplicationManagerController) pollDownloadProgress(ctx context.Context, offset int64 total int64 } - maxImageSize := int64(0) - - for _, nodeName := range im.Spec.Nodes { - for _, ref := range im.Spec.Refs { - size := im.Status.Conditions[nodeName][ref.Name]["total"] - if size == "" { - continue - } - total, _ := strconv.ParseInt(size, 10, 64) - if total > maxImageSize { - maxImageSize = total - } - } - } + maxImageSize := int64(50173680066) nodeMap := make(map[string]*progress) for _, nodeName := range im.Spec.Nodes { diff --git a/pkg/images/jobs.go b/pkg/images/jobs.go index 970a760..9c427f1 100644 --- a/pkg/images/jobs.go +++ b/pkg/images/jobs.go @@ -258,7 +258,7 @@ func updateProgress(statuses []StatusInfo, ongoing *jobs, seen map[string]int64, } offset += status.Offset } - if doneLayer == statusesLen { + if doneLayer == statusesLen && doneLayer != 0 { offset = imageSize } if imageSize != 0 {