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

Implement archive cleanup #885

Merged
merged 5 commits into from
Feb 11, 2017
Merged

Conversation

minecrafter
Copy link
Contributor

Fixes #769.

This allows Gitea to automatically purge created archives in order to better control disk space usage. Currently, archives older than 24 hours will be purged every 24 hours.

Fixes go-gitea#769

Signed-off-by: Andrew <write@imaginarycode.com>
@lunny lunny added this to the 1.1.0 milestone Feb 10, 2017
models/repo.go Outdated

for _, ty := range []string{"zip", "targz"} {
path := filepath.Join(basePath, ty)
file, err := os.Open(path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file is not close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Feb 10, 2017
@lunny
Copy link
Member

lunny commented Feb 10, 2017

LGTM

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Feb 10, 2017
Copy link
Member

@strk strk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - please also update documentation (ini cheatsheet)

models/repo.go Outdated
for _, info := range files {
if info.ModTime().Before(minimumOldestTime) && !info.IsDir() {
toDelete := filepath.Join(path, info.Name())
// This is a best-effort purge, so we do not check error codes to confirm removal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still trace-print any error (could be something a sysadmin could fix...)

models/repo.go Outdated
if err := x.
Where("id > 0").
Iterate(new(Repository),
func(idx int, bean interface{}) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be defined as a standalone function, for better readability ?

@strk
Copy link
Member

strk commented Feb 10, 2017

As my review wasn't immediately recognized by the bot, I'll take the chance to ask you to deal with the two comments I've added before convincing the bot :)

@strk
Copy link
Member

strk commented Feb 10, 2017

LGTM now - although I don't know how cheatsheet is generated

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 10, 2017
@lunny lunny merged commit 42835c7 into go-gitea:master Feb 11, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cached repository archives grow space occupation indefinitevely
4 participants