Skip to content

Commit

Permalink
Avoid acquisition when traversing to an object
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Dick committed Jun 7, 2024
1 parent 8ab6005 commit cf9395c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions perfact/zodbsync/zodbsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,18 @@ def record(self, paths, recurse=True, skip_errors=False,
remove_redundant_paths(paths)
for path in paths:
obj = self.app
try:
# traverse into the object of interest
for part in path.split('/'):
if part:
obj = getattr(obj, part)
except AttributeError:
if ignore_removed:
# traverse into the object of interest
for part in path.split('/'):
if not part:
continue
# Depending on skip_errors, this yields an error or a warning
# later
obj = None
if part not in obj.objectIds():
# Depending on skip_errors, this yields an error or a
# warning later
obj = None
break
obj = getattr(obj, part)
if obj is None and ignore_removed:
continue
self.record_obj(obj, path, recurse=recurse,
skip_errors=skip_errors)
self.fs_prune_empty_dirs()
Expand Down

0 comments on commit cf9395c

Please sign in to comment.