Ignore:
Timestamp:
4 Nov 2019, 10:15:44 (5 years ago)
Author:
uli
Message:

Bad workaround to cope with overcrowded catalogs.

Zope does not cope well with catalogs of more than 500.000 elements.
Reindexing the catalog then means to put all objects into memory before
saving them - this can blow everything.

We therefore use a dirty hack to replace the updateIndex method of
a catalog with a more careful function, that, however, should not be
run in production mode. No new items should be added during the run.

In the long run, we certainly need something more sustainable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py

    r15741 r15748  
    345345            if 'bed_id' not in cat.keys():
    346346                nothing_to_do = False
     347                # replace original `updateIndex` method
     348                def updateIndexReplacement(index):
     349                    reindex_cat(cat)
     350                cat._updateIndex = cat.updateIndex
     351                cat.updateIndex = updateIndexReplacement
     352                # setup catalog
    347353                cat[u'bed_id'] = FieldIndex(field_name=u'bed_id')
     354                cat.updateIndex = cat._updateIndex  # undo changes
    348355                logger.info(
    349356                    '%s: bed_id index added to beds_catalog.'
Note: See TracChangeset for help on using the changeset viewer.