Skip to content

Commit

Permalink
fix: rename files during the transfer, adding the .partial extension
Browse files Browse the repository at this point in the history
  • Loading branch information
DeboraTahara committed Feb 25, 2025
1 parent 85baa6d commit 58fd381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/syskit/cli/log_runtime_archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ def self.transfer_dataset(
end

transfer_results = candidates.map do |child_path|
result = transfer_file(child_path, server, root)
child_path.unlink if result.success?

child_partial_path = Pathname.new("#{child_path}.partial")
File.rename(child_path, child_partial_path)
result = transfer_file(child_partial_path, server, root)
if result.success?
child_partial_path.unlink
else
File.rename(child_partial_path, child_path)
end
result
end

Expand Down
3 changes: 3 additions & 0 deletions lib/syskit/roby_app/log_transfer_server/ftp_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def transfer(ftp, root)
rate_limit(buf.size, now, last)
last = Time.now
end
partial_file = @file
renamed_file = Pathname.new(partial_file.to_s.sub(/\.partial$/, ''))
ftp.rename(@file, renamed_file)
end
end

Expand Down

0 comments on commit 58fd381

Please sign in to comment.