Skip to content

Commit

Permalink
Merge branch 'master' into rework_request_cache#94
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Apr 20, 2020
2 parents 3f41dd7 + a44894e commit f0fc7e5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
9 changes: 6 additions & 3 deletions CHANGES.rst
@@ -1,16 +1,19 @@
Changelog
=========

5.1 (unreleased)
5.0.5 (unreleased)
----------------

- rework request caching to avoid stale cache results in scripts (with
- Rework request caching to avoid stale cache results in scripts (with
an artificial request).
For details:
`#94 <https://github.com/zopefoundation/Products.ZCatalog/issues/94>`_,
`Plone 5.2 mass migration: bad search results
<https://community.plone.org/t/potential-memory-corruption-during-migration-plone-4-2-5-2/11655/11>`_

- Fix with Python 3.8: Replace deprecated ``time.clock()`` use by
``time.process_time``.
(`#96 <https://github.com/zopefoundation/Products.ZCatalog/issues/96>`_)


5.0.4 (2020-02-11)
Expand Down Expand Up @@ -38,7 +41,7 @@ Changelog
5.0.1 (2019-06-17)
------------------

- Fix sorting of index overview table in ZMI. Migrated the template from
- Fix sorting of index overview table in ZMI. Migrated the template from
to zpt.
(`#62 <https://github.com/zopefoundation/Products.ZCatalog/issues/62>`_)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -16,7 +16,7 @@

setup(
name='Products.ZCatalog',
version='5.1.dev0',
version='5.0.5.dev0',
url='https://github.com/zopefoundation/Products.ZCatalog',
license='ZPL 2.1',
description="Zope's indexing and search solution.",
Expand Down
10 changes: 8 additions & 2 deletions src/Products/PluginIndexes/CompositeIndex/CompositeIndex.py
Expand Up @@ -31,6 +31,12 @@
from Products.PluginIndexes.unindex import _marker
from Products.ZCatalog.query import IndexQuery

try:
from time import clock as process_time
except ImportError:
from time import process_time


LOG = logging.getLogger('CompositeIndex')

QUERY_OPTIONS = {
Expand Down Expand Up @@ -530,12 +536,12 @@ def manage_fastBuild(self, threshold=None, URL1=None,
of matching field and keyword indexes """

tt = time.time()
ct = time.clock()
ct = process_time()

self.fastBuild(threshold)

tt = time.time() - tt
ct = time.clock() - ct
ct = process_time() - ct

if RESPONSE:
msg = ('ComponentIndex fast reindexed '
Expand Down
14 changes: 10 additions & 4 deletions src/Products/ZCatalog/ZCatalog.py
Expand Up @@ -57,6 +57,12 @@
# Python 3 compatibility
xrange = range

try:
from time import clock as process_time
except ImportError:
from time import process_time


_marker = object()
LOG = logging.getLogger('Zope.ZCatalog')

Expand Down Expand Up @@ -237,14 +243,14 @@ def manage_catalogReindex(self, REQUEST, RESPONSE, URL1):
""" clear the catalog, then re-index everything """

elapse = time.time()
c_elapse = time.clock()
c_elapse = process_time()

pgthreshold = self._getProgressThreshold()
handler = (pgthreshold > 0) and ZLogHandler(pgthreshold) or None
self.refreshCatalog(clear=1, pghandler=handler)

elapse = time.time() - elapse
c_elapse = time.clock() - c_elapse
c_elapse = process_time() - c_elapse

RESPONSE.redirect(
URL1
Expand Down Expand Up @@ -308,7 +314,7 @@ def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1,
""" Find object according to search criteria and Catalog them
"""
elapse = time.time()
c_elapse = time.clock()
c_elapse = process_time()

obj = REQUEST.PARENTS[1]
path = '/'.join(obj.getPhysicalPath())
Expand All @@ -328,7 +334,7 @@ def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1,
apply_path=path)

elapse = time.time() - elapse
c_elapse = time.clock() - c_elapse
c_elapse = process_time() - c_elapse

RESPONSE.redirect(
URL1
Expand Down

0 comments on commit f0fc7e5

Please sign in to comment.