Skip to content

Commit

Permalink
Fallback JSON loading during Task unserializing (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Antelox authored Sep 1, 2023
1 parent fee4947 commit 0cbb3d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion karton/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ def unserialize_resources(value: Any) -> Any:
if parse_resources:
task_data = json.loads(data, object_hook=unserialize_resources)
else:
task_data = orjson.loads(data)
try:
task_data = orjson.loads(data)
except orjson.JSONDecodeError:
# fallback, in case orjson raises exception during loading
task_data = json.loads(data, object_hook=unserialize_resources)

# Compatibility with Karton <5.2.0
headers_persistent_fallback = task_data["payload_persistent"].get(
Expand Down

0 comments on commit 0cbb3d0

Please sign in to comment.