Skip to content

Commit

Permalink
Clean up temporary snapshots when there are errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Preetha Appan committed Jul 10, 2017
1 parent 37d2320 commit 5f378a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions file_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ func (s *FileSnapshotSink) Close() error {
// Close the open handles
if err := s.finalize(); err != nil {
s.logger.Printf("[ERR] snapshot: Failed to finalize snapshot: %v", err)
if delErr := os.RemoveAll(s.dir); delErr != nil {
s.logger.Printf("[ERR] snapshot: Failed to delete temporary snapshot at path %v: %v", s.dir, delErr)
return delErr
}
return err
}

Expand Down

0 comments on commit 5f378a6

Please sign in to comment.