-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
Fixes go-gitea#769 Signed-off-by: Andrew <[email protected]>
models/repo.go
Outdated
|
||
for _, ty := range []string{"zip", "targz"} { | ||
path := filepath.Join(basePath, ty) | ||
file, err := os.Open(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file is not close
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
LGTM |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 ?
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 :) |
LGTM now - although I don't know how cheatsheet is generated |
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.