[IMP] membership_activity_gitlab: retry on 502 and 504 errors#134
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds resilience to GitLab activity imports by introducing retry behavior for transient upstream failures (502/504) in the membership_activity_gitlab integration, and by enabling transient-error retries at the GitLab client connection level.
Changes:
- Introduces a
use_gitlabdecorator to convertGitlabError502/504 intoRetryableJobErrorwith a delay. - Applies
@use_gitlabto the GitLab “iterated” fetch methods (commits/MRs/issues/notes/approvals). - Adds an initial unit test for retry behavior and enables
retry_transient_errors=Trueon the GitLab client connection.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
membership_activity_gitlab/models/project_project.py |
Adds use_gitlab decorator and applies it to GitLab pagination methods to retry on 502/504. |
gitlab/models/gitlab.py |
Enables transient error retry behavior on the python-gitlab client connection. |
membership_activity_gitlab/tests/test_gitlab.py |
Adds a test asserting 502 becomes a RetryableJobError. |
membership_activity_gitlab/tests/__init__.py |
Registers the new test module for discovery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+22
to
+26
| gl = gitlab.Gitlab( | ||
| url=self.url, | ||
| private_token=self.private_token, | ||
| retry_transient_errors=True, | ||
| ) |
| e.error_message, | ||
| seconds=60, # Retry after 1 minute | ||
| ) from e | ||
| raise e |
| new=mock_get_gitlab_commits_iterated, | ||
| ): | ||
| with self.assertRaises(RetryableJobError): | ||
| project.get_gitlab_commits_iterated(1, 100, "2024-01-01", "2024-01-31") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.