aboutsummaryrefslogtreecommitdiffstats
path: root/services/packages/packages.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/packages/packages.go')
-rw-r--r--services/packages/packages.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/services/packages/packages.go b/services/packages/packages.go
index 7f90f80baf..7f25fce5b8 100644
--- a/services/packages/packages.go
+++ b/services/packages/packages.go
@@ -336,7 +336,7 @@ func DeletePackageFile(ctx context.Context, pf *packages_model.PackageFile) erro
return packages_model.DeleteFileByID(ctx, pf.ID)
}
-// Cleanup removes old unreferenced package blobs
+// Cleanup removes expired package data
func Cleanup(unused context.Context, olderThan time.Duration) error {
ctx, committer, err := db.TxContext()
if err != nil {
@@ -345,24 +345,20 @@ func Cleanup(unused context.Context, olderThan time.Duration) error {
defer committer.Close()
if err := container_service.Cleanup(ctx, olderThan); err != nil {
- log.Error("hier")
return err
}
if err := packages_model.DeletePackagesIfUnreferenced(ctx); err != nil {
- log.Error("hier2")
return err
}
pbs, err := packages_model.FindExpiredUnreferencedBlobs(ctx, olderThan)
if err != nil {
- log.Error("hier3")
return err
}
for _, pb := range pbs {
if err := packages_model.DeleteBlobByID(ctx, pb.ID); err != nil {
- log.Error("hier4")
return err
}
}
@@ -403,10 +399,9 @@ func GetFileStreamByPackageVersionAndFileID(ctx context.Context, owner *user_mod
pv, err := packages_model.GetVersionByID(ctx, versionID)
if err != nil {
- if err == packages_model.ErrPackageVersionNotExist {
- return nil, nil, packages_model.ErrPackageNotExist
+ if err != packages_model.ErrPackageNotExist {
+ log.Error("Error getting package version: %v", err)
}
- log.Error("Error getting package version: %v", err)
return nil, nil, err
}