Skip to content

Commit

Permalink
Exit 1 if loosing leadership lease (#846)
Browse files Browse the repository at this point in the history
Exit with status 1 if lost leadership without previous graceful shutdown, so that systemd with "restart on failure" restarts it.
  • Loading branch information
carlhoerberg authored Nov 22, 2024
1 parent e3bdd3e commit 19b2652
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Increase default etcd lease TTL to 10s and run keepalive earlier [#847](https://github.com/cloudamqp/lavinmq/pull/847)
- Don't remove consumers from queue before all data is sent to client. It may cause a segmentation fault because a unmapped message segment is accessed. [#850](https://github.com/cloudamqp/lavinmq/pull/850)

### Changed

- Exit with status 1 if lost leadership so that LavinMQ is restarted by systemd [#846](https://github.com/cloudamqp/lavinmq/pull/846)

## [2.0.1] - 2024-11-13

### Fixed
Expand Down
5 changes: 3 additions & 2 deletions src/lavinmq/launcher.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ module LavinMQ
if lease = @lease
select
when lease.receive?
break unless @running
Log.warn { "Lost leadership lease" }
break
stop
exit 1
when timeout(30.seconds)
@data_dir_lock.try &.poll
GC.collect
Expand All @@ -57,7 +59,6 @@ module LavinMQ
GC.collect
end
end
stop
end

def stop
Expand Down

0 comments on commit 19b2652

Please sign in to comment.