From 6fa5de951abc02884eb37cdc6786c0f3d141ccc5 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 27 Apr 2023 16:49:05 +0700 Subject: fix validation request, add context in sale order, add benchmark apache_solr --- indoteknik_custom/models/apache_solr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/apache_solr.py') diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py index ee166002..3709e88a 100644 --- a/indoteknik_custom/models/apache_solr.py +++ b/indoteknik_custom/models/apache_solr.py @@ -12,7 +12,7 @@ class ApacheSolr(models.Model): _name = 'apache.solr' _order = 'id desc' - def _sync_product_to_solr(self, limit = 500): + def _sync_product_to_solr(self, limit=500): # _solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) _solr = pysolr.Solr('http://192.168.23.5:8983/solr/product/', always_commit=True, timeout=30) start_time = time.time() @@ -23,6 +23,7 @@ class ApacheSolr(models.Model): documents = [] counter = 0 for template in templates: + template_time = time.time() counter += 1 price_excl_after_disc = price_excl = discount = tax = 0 variants_name = variants_code = '' @@ -108,7 +109,7 @@ class ApacheSolr(models.Model): documents.append(document) template.solr_flag = 1 # add counter for monitoring - _logger.info('[SYNC_PRODUCT_TO_SOLR] %s/%i' % (counter, limit)) + _logger.info('[SYNC_PRODUCT_TO_SOLR] {}/{} {:.6f}'.format(counter, limit, time.time() - template_time)) _logger.info('[SYNC_PRODUCT_TO_SOLR] Success add to solr product %s' % template.id) _solr.add(documents) end_time = time.time() -- cgit v1.2.3