Skip to content

Commit

Permalink
Merge pull request #172 from zware/fix_future_not_awaited_warning_on_…
Browse files Browse the repository at this point in the history
…connection_loss_in_basic_publish

basic_publish: Don't create drain_future until use
  • Loading branch information
mosquito authored Oct 7, 2023
2 parents eb1ebe5 + 1ba9dc6 commit 2874e58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aiormq/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ async def basic_publish(
wait: bool = True,
) -> Optional[ConfirmationFrameType]:
_check_routing_key(routing_key)
drain_future = self.create_future() if wait else None
countdown = Countdown(timeout=timeout)

publish_frame = spec.Basic.Publish(
Expand Down Expand Up @@ -677,6 +676,7 @@ async def basic_publish(
body_frames = [publish_frame, content_header]
body_frames += self._split_body(body)

drain_future = self.create_future() if wait else None
await countdown(
self.write_queue.put(
ChannelFrame.marshall(
Expand Down

0 comments on commit 2874e58

Please sign in to comment.