Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(retries): move handle failure code outside of while loop #123

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions datahub-actions/src/datahub_actions/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ def _process_event(self, enveloped_event: EventEnvelope) -> Optional[bool]:
)
curr_attempt = curr_attempt + 1

logger.error(
f"Failed to process event after {self._retry_count} retries. event type: {enveloped_event.event_type}, pipeline name: {self.name}. Handling failure..."
)
logger.error(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good catch. Showing the error once outside the loop and incrementing the failure count.
Thank you Nate.

f"Failed to process event after {self._retry_count} retries. event type: {enveloped_event.event_type}, pipeline name: {self.name}. Handling failure..."
)

# Increment failed event count.
self._stats.increment_failed_event_count()
# Increment failed event count.
self._stats.increment_failed_event_count()

# Finally, handle the failure
self._handle_failure(enveloped_event)
# Finally, handle the failure
self._handle_failure(enveloped_event)

return retval

Expand Down
Loading