diff --git a/.gitignore b/.gitignore index c806da194..39d16e36c 100644 --- a/.gitignore +++ b/.gitignore @@ -113,7 +113,7 @@ dmypy.json #Others /.benchmarks /benchmark*.svg -/.idea +.idea dump.rdb # Redis diff --git a/remoulade/api/main.py b/remoulade/api/main.py index ab6058f31..1bea91a14 100644 --- a/remoulade/api/main.py +++ b/remoulade/api/main.py @@ -108,10 +108,8 @@ def requeue_message(message_id): @app.route("/messages/result/") @marshal_with(ResponseSchema) -def get_results(message_id): +def get_results(message_id, max_size:int = 1e4): from ..message import get_encoder - - max_size = 1e4 try: result = Result(message_id=message_id).get() encoded_result = get_encoder().encode(result).decode("utf-8") @@ -120,11 +118,11 @@ def get_results(message_id): encoded_result = f"The result is too big {size_result / 1e6}M" return {"result": encoded_result} except ResultMissing: - return {"result": "result is missing"} + return {"error": "result is missing"} except NoResultBackend: - return {"result": "no result backend"} + return {"error": "no result backend"} except (UnicodeDecodeError, TypeError): - return {"result": "non serializable result"} + return {"error": "non serializable result"} @app.route("/messages", methods=["POST"]) diff --git a/remoulade/message.py b/remoulade/message.py index 8fde3f239..efbf03577 100644 --- a/remoulade/message.py +++ b/remoulade/message.py @@ -59,7 +59,7 @@ class Message( """Encapsulates metadata about messages being sent to individual actors. Parameters: - queue_name(str): The name of the queue the message belogns to. + queue_name(str): The name of the queue the message belongs to. actor_name(str): The name of the actor that will receive the message. args(tuple): Positional arguments that are passed to the actor. kwargs(dict): Keyword arguments that are passed to the actor.