Skip to content

Commit

Permalink
Only flag PubBeforeAbort and PubBeforeAbort as retry when the event w…
Browse files Browse the repository at this point in the history
…ill actually be retried. (#502)

See plone/buildout.coredev#564
  • Loading branch information
pbauer authored and dataflake committed Feb 15, 2019
1 parent 33c01b6 commit c9c23b5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ZPublisher/WSGIPublisher.py
Expand Up @@ -160,13 +160,15 @@ def transaction_pubevents(request, response, tm=transaction.manager):
response._unauthorized()
response.setStatus(exc.getStatus())

notify(pubevents.PubBeforeAbort(
request, exc_info, request.supports_retry()))
retry = False
if isinstance(exc, TransientError) and request.supports_retry():
retry = True

notify(pubevents.PubBeforeAbort(request, exc_info, retry))
tm.abort()
notify(pubevents.PubFailure(
request, exc_info, request.supports_retry()))
notify(pubevents.PubFailure(request, exc_info, retry))

if isinstance(exc, TransientError) and request.supports_retry():
if retry:
reraise(*exc_info)

if not (exc_view_created or isinstance(exc, Unauthorized)):
Expand Down

0 comments on commit c9c23b5

Please sign in to comment.