Skip to content

Commit

Permalink
refactor: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Jan 20, 2025
1 parent eda0509 commit 24e1d7e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/controller/vacuum/vacuum.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ func (vc *Controller) StorePackage(logE *logrus.Entry, pkg *config.Package, pkgP
logE.Warn("package is nil, skipping store package")
return nil
}

vacuumPkg := vc.getVacuumPackage(pkg, pkgPath)

return vc.handleAsyncStorePackage(logE, vacuumPkg)
return vc.handleAsyncStorePackage(logE, vc.getVacuumPackage(pkg, pkgPath))
}

// getVacuumPackage converts a config
Expand Down Expand Up @@ -142,9 +139,10 @@ func (vc *Controller) listExpiredPackages(ctx context.Context, logE *logrus.Entr
return expired, nil
}

const secondsInADay = 24 * 60 * 60

// isPackageExpired checks if a package is expired based on the vacuum configuration.
func (vc *Controller) isPackageExpired(pkg *PackageVacuumEntry) bool {
const secondsInADay = 24 * 60 * 60
threshold := vc.Param.VacuumDays * secondsInADay

lastUsageTime := pkg.PackageEntry.LastUsageTime
Expand Down

0 comments on commit 24e1d7e

Please sign in to comment.