Skip to content

Commit

Permalink
Fix: Bug where all pending message would be rejected
Browse files Browse the repository at this point in the history
  • Loading branch information
1yam committed Sep 28, 2023
1 parent 7a2759f commit 06b0a31
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/aleph/web/controllers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ async def pub_on_p2p_topics(
payload: Union[str, bytes],
logger: logging.Logger,
) -> List[Protocol]:

failed_publications = []

if ipfs_service:
Expand Down Expand Up @@ -310,6 +309,12 @@ def broadcast_status_to_http_status(broadcast_status: BroadcastStatus) -> int:
return message_status_to_http_status(message_status)


def _message_to_dict(pending_message: BasePendingMessage) -> dict[str, Any]:
message_dict = pending_message.dict(exclude_none=True)
message_dict["time"] = message_dict["time"].timestamp()
return message_dict


@shielded
async def broadcast_and_process_message(
pending_message: BasePendingMessage,
Expand Down Expand Up @@ -345,7 +350,7 @@ async def broadcast_and_process_message(
p2p_client = get_p2p_client_from_request(request)

message_topic = config.aleph.queue_topic.value
message_dict = message_dict or pending_message.dict(exclude_none=True)
message_dict = message_dict or _message_to_dict(pending_message=pending_message)

failed_publications = await pub_on_p2p_topics(
p2p_client=p2p_client,
Expand Down

0 comments on commit 06b0a31

Please sign in to comment.