Skip to content

Cleanup generated files after each step - #210

Closed
yeganemehr wants to merge 2 commits into
gobackup:mainfrom
yeganemehr:cleanup-faster
Closed

Cleanup generated files after each step#210
yeganemehr wants to merge 2 commits into
gobackup:mainfrom
yeganemehr:cleanup-faster

Conversation

@yeganemehr

Copy link
Copy Markdown

Problem

It's related to #208
Model's dump directory after making compressed file is no longer needed and that space can be used in next steps.
This also apply to compressed file after encryption and encrypted file after splitting.

Solution

  1. Delete model's dump directory after making compressed file
  2. Delete compressed file after encryption (if encryption was enabled)
  3. Delete encrypted file after splitting (if split was enabled)

Comment thread model/model.go

archivePath, err = encryptor.Run(archivePath, m.Config)
logger.Infof("Cleanup WorkDir: %s/", m.Config.DumpPath)
if err := os.RemoveAll(m.Config.DumpPath); err != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This action looks like danger, we need to use a common method for cleanup the dump info, not call os.RemoveAll directly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

use model.cleanup

Comment thread model/model.go
if err != nil {
return
}
if encryptedPath != archivePath {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This logic is hard to read, I don't like it. We need to find other way to remove the last tmp file.

@github-actions github-actions Bot added the stale label Mar 26, 2025
@github-actions github-actions Bot closed this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants