Skip to content

Commit 4365ac8

Browse files
committed
moved outside the snapshots population, no need to lazyly populate
1 parent 2a8c8a8 commit 4365ac8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

arctic/store/version_store.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,13 @@ def list_versions(self, symbol=None, snapshot=None, latest_only=False):
247247
raise NoDataFoundException('No snapshot %s in library %s' % (snapshot, self._arctic_lib.get_name()))
248248

249249
versions = []
250-
snapshots = None
250+
snapshots = {ss.get('_id'): ss.get('name') for ss in self._snapshots.find()}
251251
for symbol in symbols:
252252
query['symbol'] = symbol
253253
seen_symbols = set()
254254
for version in self._versions.find(query, projection=['symbol', 'version', 'parent', 'metadata.deleted'], sort=[('version', -1)]):
255255
if latest_only and version['symbol'] in seen_symbols:
256256
continue
257-
if snapshots is None:
258-
# populate only once and if is really going to be used
259-
snapshots = {ss.get('_id'): ss.get('name') for ss in self._snapshots.find()}
260257
seen_symbols.add(version['symbol'])
261258
meta = version.get('metadata')
262259
versions.append({'symbol': version['symbol'], 'version': version['version'],

0 commit comments

Comments
 (0)