Skip to content

Commit

Permalink
distributor: the identifier we're sending isnt a user id any more, it…
Browse files Browse the repository at this point in the history
…s a greenlet id. So name the dict field appropriately.
  • Loading branch information
cyberw committed Dec 14, 2023
1 parent 5332388 commit 5ad875d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locust_plugins/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ def _distributor_request(environment: Environment, msg, **kwargs):
data = next(self.iterator)
self.runner.send_message(
f"_{name}_response",
{"payload": data, "user_id": msg.data["user_id"]},
{"payload": data, "gid": msg.data["gid"]},
client_id=msg.data["client_id"],
)

# received on worker
def _distributor_response(environment: Environment, msg, **kwargs):
_results[msg.data["user_id"]].set(msg.data)
_results[msg.data["gid"]].set(msg.data)

self.runner.register_message(f"_{name}_request", _distributor_request)
self.runner.register_message(f"_{name}_response", _distributor_response)
Expand All @@ -53,7 +53,7 @@ def __next__(self):
logging.warning("This user was already waiting for data. Strange.")

_results[gid] = AsyncResult()
self.runner.send_message(f"_{self.name}_request", {"user_id": gid, "client_id": self.runner.client_id})
self.runner.send_message(f"_{self.name}_request", {"gid": gid, "client_id": self.runner.client_id})
data = _results[gid].get()["payload"] # this waits for the reply
del _results[gid]
return data

0 comments on commit 5ad875d

Please sign in to comment.