summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/apache_solr.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-04-27 16:49:05 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-04-27 16:49:05 +0700
commit6fa5de951abc02884eb37cdc6786c0f3d141ccc5 (patch)
treee76536fa660a0af978153b7e4c9bf678b902e318 /indoteknik_custom/models/apache_solr.py
parentebbf7e832b570f1d2ecec838983b7582ade78af4 (diff)
fix validation request, add context in sale order, add benchmark apache_solr
Diffstat (limited to 'indoteknik_custom/models/apache_solr.py')
-rw-r--r--indoteknik_custom/models/apache_solr.py5
1 files changed, 3 insertions, 2 deletions
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()