From 1aa51775f3d4b794b256574500c0d9aa708f4688 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 3 Feb 2020 14:37:32 -0500 Subject: [PATCH] [DEV-6968] Client: Hook classifier after initQuote This saves a lot of time for large classifiers by waiting to invoke it until after some initial bucket setup has been done. In particular, initQuote. DelayedStagingBucket exists to try to limit the number of events that are kicked off. In this case, initQuote typically uses setCommittedValues, which DelayedStagingBucket does not override. However, overriding it did not provide a whole lot of benefit, since initQuote also calls getDataByName, which forces DelayedStagingBucket to flush so that hooks can run validations and such. The last step in Client#_changeQuote is to force the classifier to run, so this should be safe, unless calculated values happen to use classification results, in which case they'll be momentarily wrong and then immediately updated after the classifier runs. --- src/client/Client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 416e973..9941b78 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -507,8 +507,6 @@ module.exports = Class( 'Client' ) client._monitorQuote( client._quote ); - client._cmatch.hookClassifier( client._dataValidator ); - // store internal status client._isInternal = client.program.isInternal = ( data.content.internal ) @@ -528,6 +526,8 @@ module.exports = Class( 'Client' ) client.program.initQuote( bucket ); } ); + client._cmatch.hookClassifier( client._dataValidator ); + client.ui.setQuote( client._quote, client.program, clear_step ); // if logged in internally, show internal questions and do other