Skip to content

Commit

Permalink
Transfer - Fix "close of closed channel" panic (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Oct 19, 2023
1 parent b1e98b9 commit cc76175
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions artifactory/commands/transferfiles/delayedartifactshandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ func (w *SplitContentWriter) closeCurrentFile() error {
if err := w.writer.Close(); err != nil {
return err
}
defer func() {
// Reset writer and counter.
w.recordCount = 0
w.writer = nil
}()
if w.writer.GetFilePath() != "" {
fullPath, err := getUniqueErrorOrDelayFilePath(w.dirPath, func() string {
return w.filePrefix
Expand All @@ -384,9 +389,6 @@ func (w *SplitContentWriter) closeCurrentFile() error {
w.fileIndex++
}
}
// Reset writer and counter.
w.recordCount = 0
w.writer = nil
return nil
}

Expand Down

0 comments on commit cc76175

Please sign in to comment.