2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 04:27:45 +00:00
This commit is contained in:
2026-01-28 21:53:59 +00:00
parent b31c404d2b
commit 3783b49162

View File

@@ -1837,9 +1837,7 @@ class LoadingSurvex:
nlegstotal = 0
self.relativefilename = path
# Cache for survex blocks to save at the end
self._pending_parent_saves = set()
self._pending_block_saves = set()
self._pending_block_saves = set() # Cache for survex blocks to save at the end
#self.IdentifyCave(path, svxid, depth) # this will produce null for survex files which are geographic collections
self.currentsurvexfile = survexblock.survexfile
@@ -2002,12 +2000,12 @@ class LoadingSurvex:
self.fix_undated(survexblock)
self.fix_anonymous(survexblock)
# This is the most time-consuming step within *end processing: 47%
# This is the most time-consuming step within *end processing: was 47%
# Instead of saving parent here, cache for later
if hasattr(survexblock, 'parent') and survexblock.parent:
self._pending_block_saves.add(survexblock)
try:
# This is the second most time-consuming step within *end processing: 35%
# This is the second most time-consuming step within *end processing: was 35%
self._pending_block_saves.add(survexblock)
# update_fields=["legsall", "legslength"]
except Exception:
@@ -2136,8 +2134,8 @@ class LoadingSurvex:
# print(f" ! Block {block} is invalid: {e}")
try:
BATCH_SIZE = 900
for i in range(0, len(valid_blocks), BATCH_SIZE):
SurvexBlock.objects.bulk_update(valid_blocks[i:i+BATCH_SIZE], ["legsall", "legslength", "parent"])
for i in range(0, len(blocks), BATCH_SIZE):
SurvexBlock.objects.bulk_update(blocks[i:i+BATCH_SIZE], ["legsall", "legslength", "parent"])
except Exception as e:
print(f"\n !! Error in bulk_update for survexblocks: {e}", file=sys.stderr)