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

Stop client_listener from raising a KeyError when receiving a client_stopped message from unknown worker #2102

Merged
merged 2 commits into from
May 22, 2022

Conversation

BirdLearn
Copy link
Contributor

fix: client_listener will raise an KeyError error when received a client_stopped message from an unknown worker.

…ent_stopped message from an unknown worker.
@cyberw
Copy link
Collaborator

cyberw commented May 20, 2022

We need to at least log a warning when it happens. Also, to avoid the deep nesting, can you reverse the if-statement to be:

if not msg.node_id in self.clients:
    continue

@BirdLearn
Copy link
Contributor Author

We need to at least log a warning when it happens. Also, to avoid the deep nesting, can you reverse the if-statement to be:

if not msg.node_id in self.clients:
    continue

When I modified the code, I found that the same judgment was made on other conditional branches, such as "heartbeat" and "quit", so, in order to keep the code style consistent, I made the same code modification.

In addition, I found that after processing the message, there is a check_stopped() call, if I use "continue " to skip this loop, it will not execute to check_stopped(), I am worried about other side effects.

@cyberw
Copy link
Collaborator

cyberw commented May 22, 2022

Not calling check_stopped in this case should be fine (this is only relevant if a worker has actually stopped, so skipping it is a).

In this case I think readability (and minimizing the changes to maintain git blame history) is more important than consistency.

But the logging is the most important.

@cyberw cyberw changed the title fix: client_listener raise an KeyError error Stop client_listener from raising a KeyError when receiving a client_stopped message from unknown worker May 22, 2022
@cyberw cyberw merged commit bc11eec into locustio:master May 22, 2022
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.

None yet

2 participants