File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,10 +86,8 @@ def _async_add(self, record: _DNSRecord) -> bool:
8686 # replaces any existing records that are __eq__ to each other which
8787 # removes the risk that accessing the cache from the wrong
8888 # direction would return the old incorrect entry.
89- if record . key not in self .cache :
89+ if ( store := self .cache . get ( record . key )) is None :
9090 store = self .cache [record .key ] = {}
91- else :
92- store = self .cache [record .key ]
9391 new = record not in store and not isinstance (record , DNSNsec )
9492 store [record ] = record
9593 when = record .created + (record .ttl * 1000 )
@@ -100,10 +98,8 @@ def _async_add(self, record: _DNSRecord) -> bool:
10098
10199 if isinstance (record , DNSService ):
102100 service_record = record
103- if service_record . server_key not in self .service_cache :
101+ if ( service_store := self .service_cache . get ( service_record . server_key )) is None :
104102 service_store = self .service_cache [service_record .server_key ] = {}
105- else :
106- service_store = self .service_cache [service_record .server_key ]
107103 service_store [service_record ] = service_record
108104 return new
109105
You can’t perform that action at this time.
0 commit comments