File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ Unreleased
20
20
21
21
Enhancements
22
22
~~~~~~~~~~~~
23
+ * [v3] Dramatically reduce number of ``__contains_ `` requests in favor of optimistically calling `__getitem__ `
24
+ and handling any error that may arise.
25
+ By :user: `Deepak Cherian <dcherian> `.
23
26
24
27
* [v3] Reuse the download array metadata when creating an ``Array ``.
25
28
By :user: `Deepak Cherian <dcherian> `.
Original file line number Diff line number Diff line change @@ -151,19 +151,20 @@ def _put_nosync(self, d):
151
151
if self .cache :
152
152
self ._cached_asdict = d
153
153
else :
154
- if self .key in self .store :
154
+ try :
155
+ meta_unparsed = self .store [self .key ]
155
156
# Cannot write the attributes directly to JSON, but have to
156
157
# store it within the pre-existing attributes key of the v3
157
158
# metadata.
158
159
159
160
# Note: this changes the store.counter result in test_caching_on!
160
161
161
- meta = self .store ._metadata_class .parse_metadata (self . store [ self . key ] )
162
+ meta = self .store ._metadata_class .parse_metadata (meta_unparsed )
162
163
if "attributes" in meta and "filters" in meta ["attributes" ]:
163
164
# need to preserve any existing "filters" attribute
164
165
d ["attributes" ]["filters" ] = meta ["attributes" ]["filters" ]
165
166
meta ["attributes" ] = d ["attributes" ]
166
- else :
167
+ except KeyError :
167
168
meta = d
168
169
self .store [self .key ] = json_dumps (meta )
169
170
if self .cache :
You can’t perform that action at this time.
0 commit comments