Skip to content

Commit

Permalink
handler malformed json
Browse files Browse the repository at this point in the history
  • Loading branch information
felipao-mx committed Apr 3, 2023
1 parent 995d376 commit fab314d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion fast_agave/tasks/sqs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
from functools import wraps
from itertools import count
from json import JSONDecodeError
from typing import AsyncGenerator, Callable, Coroutine

from aiobotocore.httpsession import HTTPClientError
Expand Down Expand Up @@ -99,7 +100,11 @@ async def concurrency_controller(coro: Coroutine) -> None:
can_read,
sqs,
):
body = json.loads(message['Body'])
try:
body = json.loads(message['Body'])
except JSONDecodeError:
continue

message_receive_count = int(
message['Attributes']['ApproximateReceiveCount']
)
Expand Down
2 changes: 1 addition & 1 deletion fast_agave/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.9.0.dev0'
__version__ = '0.9.0.dev1'
1 change: 0 additions & 1 deletion tests/tasks/test_sqs_celery_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async def test_send_task(sqs_client) -> None:
base64.b64decode(message['body'].encode('utf-8')).decode()
)

# breakpoint()
assert body_json[0] == args
assert body_json[1] == kwargs
assert message['headers']['lang'] == 'py'
Expand Down

0 comments on commit fab314d

Please sign in to comment.