Skip to content

Commit

Permalink
fix: fix install progress wrong (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH committed Mar 20, 2024
1 parent f288c70 commit a9a77a1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions service/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,17 @@ func pullImageProgress(ctx context.Context, out io.ReadCloser, notificationType
currentImageFraction := float32(currentImage) / float32(totalImageNum)
progress := completedFraction * currentImageFraction * 100

// ensure progress is in [0, 100]
if progress < 0 {
progress = 0
}
if progress > 100 {
progress = 100
}

// reduce the event send frequency
throttler.ThrottleFunc(func() {
go func(progress int) {
// ensure progress is in [0, 100]
if progress < 0 {
progress = 0
}
if progress > 100 {
progress = 100
}

PublishEventWrapper(ctx, common.EventTypeAppInstallProgress, map[string]string{
common.PropertyTypeAppProgress.Name: fmt.Sprintf("%d", progress),
})
Expand Down

0 comments on commit a9a77a1

Please sign in to comment.