Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower memory usage for aptly db cleanup #762

Merged
merged 1 commit into from
Jul 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmd/db_cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err
}

context.CollectionFactory().Flush()

if verbose {
context.Progress().ColoredPrintf("@{y}Loading local repos:@|")
}
Expand Down Expand Up @@ -90,6 +92,8 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err
}

context.CollectionFactory().Flush()

if verbose {
context.Progress().ColoredPrintf("@{y}Loading snapshots:@|")
}
Expand Down Expand Up @@ -118,6 +122,8 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err
}

context.CollectionFactory().Flush()

if verbose {
context.Progress().ColoredPrintf("@{y}Loading published repositories:@|")
}
Expand Down Expand Up @@ -150,6 +156,8 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err
}

context.CollectionFactory().Flush()

// ... and compare it to the list of all packages
context.Progress().ColoredPrintf("@{w!}Loading list of all packages...@|")
allPackageRefs := context.CollectionFactory().PackageCollection().AllPackageRefs()
Expand Down Expand Up @@ -192,6 +200,8 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
}
}

context.CollectionFactory().Flush()

// now, build a list of files that should be present in Repository (package pool)
context.Progress().ColoredPrintf("@{w!}Building list of files referenced by packages...@|")
referencedFiles := make([]string, 0, existingPackageRefs.Len())
Expand Down