From 523acb31bcbf58648bf3acaafe12667b6e5fc90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20B=C3=B6rjesson?= Date: Wed, 20 Nov 2024 08:09:30 +0100 Subject: [PATCH] Log how many files are sent on full sync --- src/lavinmq/clustering/follower.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lavinmq/clustering/follower.cr b/src/lavinmq/clustering/follower.cr index 1f3e39aa37..7e72ea6722 100644 --- a/src/lavinmq/clustering/follower.cr +++ b/src/lavinmq/clustering/follower.cr @@ -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 @@ -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 @@ -114,6 +116,7 @@ module LavinMQ end socket.write_bytes 0i32 socket.flush + count end private def send_requested_files(socket = @socket)