collective / sc.social.like

Social: Like Actions is a Plone package (add-on) providing simple Google+, Twitter and Facebook integration for Plone Content Types.
7 stars 23 forks source link

Log errors and proceed when reindexing #172

Open tobiasherp opened 5 years ago

tobiasherp commented 5 years ago

We have a ZODB which contains at least one object (after processing of 13000 objects) which can't be reindexed.

Of course we do want the remaining 50000 objects to be reindexed, and we'd like to know which one causes the trouble.

Thus,

ZODB ConflictErrors are not handled that way (yet?) but re-raised.

tobiasherp commented 5 years ago

PyLint complains about an unused variable, but it is wrong: That e variable is used, in fact. It is contained in the locals() result which is given to the logger.error call.

This is a little bit "special", but there is a good reason I use this syntax all the time: If, according to the current log level, the log message doesn't need to be written, it is not formatted, either.

So, what do we do about this?

tobiasherp commented 5 years ago

Sorry for the noise. The most important change seems to be to catch AttributeErrors as well in the utils.get_valid_objects function.

idgserpro commented 5 years ago

@tobiasherp does the upgrade step not stop when a ConflictErrors occurs but stop for when another error occurs? It is?