Skip to content

Commit

Permalink
clean up review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Dec 13, 2024
1 parent d3d6cb1 commit 81ee5fd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/lavinmq/clustering/follower.cr
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ module LavinMQ
end

private def read_ack(socket = @socket) : Int64
# Sometimes when running clustering_spec len is greater than sent_bytes. Causing lag_in_bytes to be negative.
len = socket.read_bytes(Int64, IO::ByteFormat::LittleEndian)
@acked_bytes += len
STDOUT.write "Follower #{@remote_address} read ack of #{len} acked_bytes=#{@acked_bytes} sent_bytes=#{@sent_bytes}\n".to_slice
if @closed && lag_in_bytes.zero?
@closed_and_in_sync.close
end
Expand Down
18 changes: 9 additions & 9 deletions src/lavinmq/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ module LavinMQ
property http_unix_path = ""
property http_systemd_socket_name = "lavinmq-http.socket"
property amqp_systemd_socket_name = "lavinmq-amqp.socket"
property heartbeat = 300_u16 # second
property frame_max = 131_072_u32 # bytes
property channel_max = 2048_u16 # number
property stats_interval = 5000 # millisecond
property stats_log_size = 120 # 10 mins at 5s interval
property? set_timestamp = false # in message headers when receive
property socket_buffer_size = 16384 # bytes
property? tcp_nodelay = false # bool
property max_inflight_messages : UInt16 = 65_535
property heartbeat = 300_u16 # second
property frame_max = 131_072_u32 # bytes
property channel_max = 2048_u16 # number
property stats_interval = 5000 # millisecond
property stats_log_size = 120 # 10 mins at 5s interval
property? set_timestamp = false # in message headers when receive
property socket_buffer_size = 16384 # bytes
property? tcp_nodelay = false # bool
property segment_size : Int32 = 8 * 1024**2 # bytes
property max_inflight_messages : UInt16 = 65_535
property? raise_gc_warn : Bool = false
property? data_dir_lock : Bool = true
property tcp_keepalive : Tuple(Int32, Int32, Int32)? = {60, 10, 3} # idle, interval, probes/count
Expand Down
2 changes: 1 addition & 1 deletion src/lavinmq/mqtt/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module LavinMQ
end

def close(reason = "")
@log.trace { "Client#close" }
@log.debug { "Client#close" }
@closed = true
@socket.close
end
Expand Down
5 changes: 2 additions & 3 deletions src/lavinmq/mqtt/retain_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ module LavinMQ
block.call(topic, read(file_name))
end
end
nil
end

private def read(file_name : String) : Bytes
Expand All @@ -164,9 +163,9 @@ module LavinMQ

def make_file_name(topic : String) : String
@hasher.update topic.to_slice
hash = @hasher.hexfinal
"#{@hasher.hexfinal}#{MESSAGE_FILE_SUFFIX}"
ensure
@hasher.reset
"#{hash}#{MESSAGE_FILE_SUFFIX}"
end
end
end
Expand Down

0 comments on commit 81ee5fd

Please sign in to comment.