Skip to content

Commit

Permalink
Bugfix: shovel sources reconnect (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun authored Aug 26, 2024
1 parent 46794a1 commit 7db7cda
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Shovel AMQP source didn't reconnect on network failures (partially fixed in prev release) [#758](https://github.com/cloudamqp/lavinmq/pull/758)

## [2.0.0-rc.4] - 2024-08-21

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ shards:

amqp-client:
git: https://github.com/cloudamqp/amqp-client.cr.git
version: 1.2.5
version: 1.2.6

lz4:
git: https://github.com/84codes/lz4.cr.git
Expand Down
1 change: 1 addition & 0 deletions spec/server_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe LavinMQ::Server do
msg.reject(requeue: false)
done.send nil
end
rescue AMQP::Client::Connection::ClosedException
end
end
timeout = false
Expand Down
19 changes: 5 additions & 14 deletions spec/shovel_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,15 @@ describe LavinMQ::Shovel do
direct_user: s.users.direct_user
)

wg = WaitGroup.new(1)
exception : Exception? = nil
spawn do
source.start
wg.done
source.start

s.vhosts["/"].queues["source"].publish(LavinMQ::Message.new("", "", ""))
expect_raises(AMQP::Client::Connection::ClosedException) do
source.each do
s.vhosts["/"].connections.each &.close("spec")
end
rescue ex
exception = ex
ensure
wg.done
end
wg.wait # wait for source to start
wg.add 1
s.vhosts["/"].connections.each &.close("spec")
wg.wait # wait for exception to be rescued
source.started?.should be_false
exception.should be_a AMQP::Client::Connection::ClosedException
end
end
end
Expand Down

0 comments on commit 7db7cda

Please sign in to comment.