From 293b460cab69f55f91a3356905bf949146b03be4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 17 Jun 2024 15:56:06 +0200 Subject: [PATCH] :zap: Fix a performance regression with file validation with some features The feature fdata/pointer-map tracking mechanism interacts pretty bad with possible local mutations on the validation subsystem. The fix consist on disabling the tracking mechanism on the validation. --- backend/src/app/rpc/commands/files_update.clj | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/backend/src/app/rpc/commands/files_update.clj b/backend/src/app/rpc/commands/files_update.clj index c9bf2aea9..b071b3f1a 100644 --- a/backend/src/app/rpc/commands/files_update.clj +++ b/backend/src/app/rpc/commands/files_update.clj @@ -324,19 +324,21 @@ (update :data cpc/process-changes changes) (update :data d/without-nils))] - (when (contains? cf/flags :soft-file-validation) - (soft-validate-file! file libs)) - (when (contains? cf/flags :soft-file-schema-validation) - (soft-validate-file-schema! file)) + (binding [pmap/*tracked* nil] + (when (contains? cf/flags :soft-file-validation) + (soft-validate-file! file libs)) - (when (and (contains? cf/flags :file-validation) - (not skip-validate)) - (val/validate-file! file libs)) + (when (contains? cf/flags :soft-file-schema-validation) + (soft-validate-file-schema! file)) - (when (and (contains? cf/flags :file-schema-validation) - (not skip-validate)) - (val/validate-file-schema! file)) + (when (and (contains? cf/flags :file-validation) + (not skip-validate)) + (val/validate-file! file libs)) + + (when (and (contains? cf/flags :file-schema-validation) + (not skip-validate)) + (val/validate-file-schema! file))) (cond-> file (contains? cfeat/*current* "fdata/objects-map")