From 5ad875d8a7b3b97650e6808998ce7cff9e885c1e Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Thu, 14 Dec 2023 16:36:50 +0100 Subject: [PATCH] distributor: the identifier we're sending isnt a user id any more, its a greenlet id. So name the dict field appropriately. --- locust_plugins/distributor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locust_plugins/distributor.py b/locust_plugins/distributor.py index ef0b5ff..c8e5b0c 100644 --- a/locust_plugins/distributor.py +++ b/locust_plugins/distributor.py @@ -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) @@ -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