Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
76c2a7be5e
fix ErrorOnlyArchiver logging Error, also when there is none
All checks were successful
go/archiver/pipeline/head This commit looks good
2024-10-26 19:13:32 +02:00
1449729882
first write Error file then Move File, so the move error can also be detected while the error writing is always done first
All checks were successful
go/archiver/pipeline/head This commit looks good
2024-09-27 16:59:38 +02:00
2 changed files with 7 additions and 2 deletions

View file

@ -9,10 +9,12 @@ func NewErrorOnlyArchiver(conf *Config) func(string, error) {
return func(filePath string, archiveErr error) {
if archiveErr != nil {
err := writeErrorFile(conf, filePath, archiveErr)
if err != nil {
logger.Error(err)
}
}
}
}
func writeErrorFile(conf *Config, filePath string, archiveErr error) error {
if archiveErr != nil {

View file

@ -94,10 +94,13 @@ func moveToError(conf *Config, filePath string, archiveErr error) error {
if err != nil {
return err
}
err = os.Rename(filePath, filepath.Join(destFolder, baseName))
err = writeErrorFile(conf, filePath, archiveErr)
if err != nil {
return err
}
err = os.Rename(filePath, filepath.Join(destFolder, baseName))
if err != nil {
return err
}
return nil
}