Remove the blob temp file when a backup stops part-way (closes #302)
check / check (push) Waiting to run
check / check (push) Waiting to run
When `snapshot create` stopped on a file error, a full temporary directory or Ctrl-C, the blob being packed was never finalized, and its `vaultik-blob-*.tmp` file (up to `blob_size_limit` of encrypted data) stayed in `$TMPDIR`. Phase 2 now calls the new `Packer.DiscardCurrentBlob` on the way out, which closes and removes that file. After a successful flush no blob is in progress, so the call then does nothing. The blob's row in the local index is left, as before, for the next run's repair of interrupted blobs to remove. Model: opus-5-5
This commit is contained in:
@@ -1295,6 +1295,11 @@ func (s *Scanner) batchAddFilesToSnapshot(
|
||||
func (s *Scanner) processPhase(
|
||||
ctx context.Context, filesToProcess []*FileToProcess, result *ScanResult,
|
||||
) error {
|
||||
// On an error or cancellation the blob being packed is never
|
||||
// finalized, so its temp file must be removed here. After a
|
||||
// successful flush there is no such blob and this does nothing.
|
||||
defer s.packer.DiscardCurrentBlob()
|
||||
|
||||
// Calculate total bytes to process
|
||||
var totalBytes int64
|
||||
for _, f := range filesToProcess {
|
||||
|
||||
Reference in New Issue
Block a user