Skip to content

Commit ceb0def

Browse files
authored
Reduce branching in Zeroconf.handle_response (#459)
1 parent 5e24da0 commit ceb0def

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

zeroconf/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import enum
2424
import errno
2525
import ipaddress
26+
import itertools
2627
import logging
2728
import platform
2829
import re
@@ -2935,9 +2936,7 @@ def handle_response(self, msg: DNSIncoming) -> None: # pylint: disable=too-many
29352936
# zc.get_service_info will see the cached value
29362937
# but ONLY after all the record updates have been
29372938
# processsed.
2938-
for record in address_adds:
2939-
self.cache.add(record)
2940-
for record in other_adds:
2939+
for record in itertools.chain(address_adds, other_adds):
29412940
self.cache.add(record)
29422941
# Removes are processed last since
29432942
# ServiceInfo could generate an un-needed query

0 commit comments

Comments
 (0)