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

misc #319

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

misc #319

Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ dmypy.json
#Others
/.benchmarks
/benchmark*.svg
/.idea
.idea
dump.rdb

# Redis
Expand Down
10 changes: 4 additions & 6 deletions remoulade/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ def requeue_message(message_id):

@app.route("/messages/result/<message_id>")
@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")
Expand All @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion remoulade/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down