Skip to content

Commit

Permalink
Merge 4161ec9 into 4771b52
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Dec 28, 2014
2 parents 4771b52 + 4161ec9 commit d7ea835
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,12 @@
Changelog
=========

1.3 (unreleased)
----------------

- Refactor upgrade step to reduce memory consumption and avoid restarts on instances running with supervisor's memmon.
[hvelarde]

1.2 (2014-10-15)
----------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages

version = '1.2'
version = '1.3-dev0'

setup(
name='plone.app.imagecropping',
Expand Down
8 changes: 5 additions & 3 deletions src/plone/app/imagecropping/upgrades/__init__.py
Expand Up @@ -18,8 +18,10 @@ def to_0004(context):
"""
iface = 'plone.app.imagecropping.interfaces.IImageCropping'
cat = getToolByName(context, 'portal_catalog')
brains = cat(object_provides=iface)

for brain in brains:
obj = brain.getObject()
# this consumes a lot of memory if we have too many objects to
# update; we better use a generator to reduce memory usage and
# avoid restarts on instances running with supervisor's memmon
results = (b.getObject() for b in cat(object_provides=iface))
for obj in results:
obj.reindexObject(idxs=['object_provides'])

0 comments on commit d7ea835

Please sign in to comment.