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

Ignore MemberAlreadyExist exception during startup. #5765

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion st2common/st2common/service_setup.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
from tooz.coordination import GroupAlreadyExist
from tooz.coordination import GroupNotCreated
from tooz.coordination import MemberNotJoined
from tooz.coordination import MemberAlreadyExist

from st2common import log as logging
from st2common.constants.logging import DEFAULT_LOGGING_CONF_PATH
@@ -341,7 +342,10 @@ def register_service_in_service_registry(service, capabilities=None, start_heart
'Joining service registry group "%s" as member_id "%s" with capabilities "%s"'
% (group_id, member_id, capabilities)
)
return coordinator.join_group(group_id, capabilities=capabilities).get()
try:
return coordinator.join_group(group_id, capabilities=capabilities).get()
except MemberAlreadyExist:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

More comment on legacy, but in the try we return whatever coordinator.join_group returns, but if memberalreadyexists we don't return anything...
I think in fact the join_group doesn't return anything - so probably just worth changing it so that we change the try to remove the "return" on the call to coordinator.join_group. Or if its expected to return something then we need to adjust the except clause...



def deregister_service(service, start_heart=True):