Skip to content

Commit

Permalink
Log how many files are sent on full sync (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun authored Nov 20, 2024
1 parent ed9ddcd commit 4df08a6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lavinmq/clustering/follower.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ module LavinMQ

def full_sync : Nil
Log.info { "Calculating hashes" }
send_file_list
Log.info { "File list sent" }
count = send_file_list
Log.info { "File list sent (#{count} files}" }
send_requested_files
end

Expand Down Expand Up @@ -105,7 +105,9 @@ module LavinMQ
end

private def send_file_list(socket = @lz4)
count = 0
@file_index.files_with_hash do |path, hash|
count &+= 1
path = path[@data_dir.bytesize + 1..]
socket.write_bytes path.bytesize.to_i32, IO::ByteFormat::LittleEndian
socket.write path.to_slice
Expand All @@ -114,6 +116,7 @@ module LavinMQ
end
socket.write_bytes 0i32
socket.flush
count
end

private def send_requested_files(socket = @socket)
Expand Down

0 comments on commit 4df08a6

Please sign in to comment.