Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clustering: log how many files are sent on full sync #855

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading