fix(outbound): return early if there are no messages to be sent
This commit is contained in:
parent
ff7282ea3b
commit
daabd385c2
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue