mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 19:09:32 +00:00
Improve loops and lists (#113269)
* Enable PERF * Enable PERF rule * Enable PERF rule * Don't enable flag yet
This commit is contained in:
committed by
GitHub
parent
8a98fb7cfd
commit
05172d8e4d
@@ -230,15 +230,14 @@ class AWSSQS(AWSNotify):
|
||||
async with self.session.create_client(
|
||||
self.service, **self.aws_config
|
||||
) as client:
|
||||
tasks = []
|
||||
for target in kwargs.get(ATTR_TARGET, []):
|
||||
tasks.append(
|
||||
client.send_message(
|
||||
QueueUrl=target,
|
||||
MessageBody=json_body,
|
||||
MessageAttributes=message_attributes,
|
||||
)
|
||||
tasks = [
|
||||
client.send_message(
|
||||
QueueUrl=target,
|
||||
MessageBody=json_body,
|
||||
MessageAttributes=message_attributes,
|
||||
)
|
||||
for target in kwargs.get(ATTR_TARGET, [])
|
||||
]
|
||||
|
||||
if tasks:
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
Reference in New Issue
Block a user