Skip to content

Commit e8df735

Browse files
committed
[property] Use custom cardinality check validation
The cardinality checks are run quite frequently; everytime a value is changed in addition to changes of a cardinality itself. To reduce the load of background checks on the Document, a custom validations that only runs the specific value cardinality check is used instead.
1 parent eab8e6a commit e8df735

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

odml/property.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,12 @@ def _values_cardinality_validation(self):
573573
Runs a validation to check whether the values cardinality
574574
is respected and prints a warning message otherwise.
575575
"""
576-
valid = validation.Validation(self)
576+
# This check is run quite frequently so do not run all checks via the default validation
577+
# but use a custom validation instead.
578+
valid = validation.Validation(self, validate=False, reset=True)
579+
valid.register_custom_handler("property", validation.property_values_cardinality)
580+
valid.run_validation()
581+
577582
val_id = validation.IssueID.property_values_cardinality
578583

579584
# Make sure to display only warnings of the current property

0 commit comments

Comments
 (0)