Skip to content

Commit

Permalink
perf
Browse files Browse the repository at this point in the history
  • Loading branch information
snichme committed Oct 10, 2024
1 parent b1ee854 commit 27f4268
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lavinmq/exchange/exchange.cr
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ module LavinMQ
count = 0
queues.each do |queue|
if queue.publish(msg)
@publish_out_count += 1
count += 1
msg.body_io.seek(-msg.bodysize.to_i64, IO::Seek::Current) # rewind
end
end
@publish_out_count += count
count
end

Expand Down Expand Up @@ -209,8 +209,7 @@ module LavinMQ
return unless cc = headers[key]?
cc = cc.as?(Array(AMQP::Field))

err = Error::PreconditionFailed.new("#{key} header not a string array")
raise err unless cc
raise Error::PreconditionFailed.new("#{key} header not a string array") unless cc

hdrs = headers.clone
hdrs.delete "CC"
Expand All @@ -219,7 +218,7 @@ module LavinMQ
if rk = rk.as?(String)
find_queues(rk, hdrs, queues)
else
raise err
raise Error::PreconditionFailed.new("#{key} header not a string array")
end
end
end
Expand Down

0 comments on commit 27f4268

Please sign in to comment.