2
0
Fork 0

fix(outbound): return early if there are no messages to be sent

This commit is contained in:
Luca 2024-05-10 18:02:40 +02:00
parent ff7282ea3b
commit daabd385c2
1 changed files with 4 additions and 1 deletions

View File

@ -31,10 +31,13 @@ def send(messages):
else: else:
messages = list(messages) messages = list(messages)
if len(messages) == 0:
return
sent_messages = 0 sent_messages = 0
for message in sender.send(messages): for message in sender.send(messages):
sent_messages += 1 sent_messages += 1
yield message yield message
if sent_messages == 0 and len(messages) > 0: if sent_messages == 0:
raise OutboundMessageError("no messages have been sent") raise OutboundMessageError("no messages have been sent")