Skip to content

JIRA: add retry/rate limit support#13786

Merged
rossops merged 1 commit intoDefectDojo:bugfixfrom
valentijnscholten:jira-rate-limiting
Dec 1, 2025
Merged

JIRA: add retry/rate limit support#13786
rossops merged 1 commit intoDefectDojo:bugfixfrom
valentijnscholten:jira-rate-limiting

Conversation

@valentijnscholten
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten commented Nov 29, 2025

fixes #13769

Enable JIRA Connection Retries and Rate Limiting Support

image

Summary

This PR enables configurable retry and timeout settings for JIRA connections to handle rate limiting (HTTP 429) and connection errors gracefully. Previously, JIRA connections had retries disabled (max_retries=0), causing immediate failures on rate limits or transient network issues.

Changes

Configuration

Added three new environment variables:

  • DD_JIRA_MAX_RETRIES (default: 3): Maximum number of retry attempts for recoverable errors (429, 503, ConnectionError)
  • DD_JIRA_CONNECT_TIMEOUT (default: 10 seconds): Connection timeout for establishing a connection to the JIRA server
  • DD_JIRA_READ_TIMEOUT (default: 30 seconds): Read timeout for waiting for a response from the JIRA server

Technical Details

Retry Behavior

The jira library automatically retries on:

  • HTTP 429 (Too Many Requests) - Rate limiting
  • HTTP 503 (Service Unavailable) - Temporary server errors
  • ConnectionError - Network connectivity issues

Migration Notes

No migration required. The new settings use sensible defaults that match the previous behavior for retries (now enabled with 3 retries instead of 0) and add timeout configuration.

Testing

Tested with:

  • Management command to push finding 1 finding 500 times with 10 parallel celery workers
celeryworker-10     | [29/Nov/2025 13:30:49] WARNING [jira.resilientsession:381] Request rate limited by Jira. Request should be retried after 1 seconds.
celeryworker-10     | [29/Nov/2025 13:30:49] WARNING [jira.resilientsession:334] Got recoverable error from GET https://xx.atlassian.net/rest/api/2/issue/22871, will retry [1/3] in 1.5314574809826222s. Err: 429 Too Many Requests
celeryworker-6      | [29/Nov/2025 13:30:50] WARNING [jira.resilientsession:381] Request rate limited by Jira. Request should be retried after 1 seconds.
celeryworker-6      | [29/Nov/2025 13:30:50] WARNING [jira.resilientsession:334] Got recoverable error from GET https://xxx.atlassian.net/rest/api/2/issue/22871, will retry [1/3] in 1.8632971142324433s. Err: 429 Too Many Requests
celeryworker-9      | [29/Nov/2025 13:30:49] WARNING [jira.resilientsession:381] Request rate limited by Jira. Request should be retried after 1 seconds.
celeryworker-9      | [29/Nov/2025 13:30:49] WARNING [jira.resilientsession:334] Got recoverable error from GET https://xx.atlassian.net/rest/api/2/issue/22871, will retry [1/3] in 1.635605867089348s. Err: 429 Too Many Requests

Future improvements

If we encounter retry delays of over 60s, we may consider adding another layer of retries in our celery task where we just reschedule the task with a delay. This avoids blocking other waiting tasks, but has other challenges.

@valentijnscholten valentijnscholten added this to the 2.53.0 milestone Nov 29, 2025
@github-actions github-actions Bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR docs labels Nov 29, 2025
@valentijnscholten valentijnscholten changed the title JIRA: add retries/rate limit support JIRA: add retry/rate limit support Nov 29, 2025
Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

@rossops rossops merged commit 59c6692 into DefectDojo:bugfix Dec 1, 2025
278 of 279 checks passed
Maffooch pushed a commit to valentijnscholten/django-DefectDojo that referenced this pull request Feb 16, 2026
…limiting

JIRA: add retry/rate limit support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants