Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Launcher the starting point in all cases #909

Merged
merged 7 commits into from
Jan 16, 2025
Merged

Make Launcher the starting point in all cases #909

merged 7 commits into from
Jan 16, 2025

Conversation

spuun
Copy link
Member

@spuun spuun commented Jan 14, 2025

WHAT is this pull request doing?

After other refactoring lavinmq no longer released its leader lease on graceful shutdown. The problem was that Launcher handled the signal, but didn't have a reference to Clustering::Controller or the Leadership, and therefore couldn't release the lease.

When looking into different solutions I realized that we had two ways of starting lavinmq: Launcher and Clustering::Controller.

This PR will refactor the upstart to make Launcher responsible for the upstart. This also makes launcher the signal handler instead of having this in both Launcher and Clustering::Client. Launcher will now have a reference to Clustering::Controller instead of the other way around.

HOW can this pull request be tested?

Specs still passes, but some things needs to be tested manually.

@spuun spuun requested a review from a team as a code owner January 14, 2025 09:03
if @config.clustering?
etcd = Etcd.new(@config.clustering_etcd_endpoints)
@runner = controller = Clustering::Controller.new(@config, etcd)
@replicator = Clustering::Server.new(@config, etcd, controller.id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make Clustering::Server accept a Clustering::Controller instead of etcd and id, and then add methods to Clustering::Controller to handle cluster secret and isr. That would isolate all etcd code to Clustering::Controller.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but you would like to do that in another PR or?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

src/lavinmq/clustering/controller.cr Show resolved Hide resolved
src/lavinmq/launcher.cr Show resolved Hide resolved
src/lavinmq/launcher.cr Outdated Show resolved Hide resolved
src/lavinmq/clustering/controller.cr Show resolved Hide resolved
@spuun spuun merged commit d46c3b8 into main Jan 16, 2025
25 checks passed
@spuun spuun deleted the refactor-upstart branch January 16, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants