Skip to content

Conversation

@wterpstra
Copy link

By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.

Description

This PR adds a configurable retry mechanism for scan creation when the queue capacity is reached (error code 142). The implementation includes exponential backoff to handle temporary queue capacity issues gracefully.

Changes include:

  • New --scan-enqueue-retries flag to control number of retry attempts (default: 0, no retries)
  • New --scan-enqueue-retry-delay flag to set base delay between retries (default: 5 seconds)
  • Exponential backoff: delay doubles with each retry attempt (e.g., 5s, 10s, 20s)
  • Queue capacity error detection and retry logic in scans-http.go:40
  • Mock test support for queue capacity errors
  • Verbose logging for retry attempts

Type of Change

  • New feature (non-breaking change which adds functionality)

Related Issues

Fixes #1349

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules
  • I have updated the CLI help for new/changed functionality in this PR (if applicable)
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Additional Notes

The default behavior remains unchanged (0 retries), ensuring backwards compatibility. Users can opt-in to retry functionality by setting the flags or environment variables (CX_SCAN_ENQUEUE_RETRIES, CX_SCAN_ENQUEUE_RETRY_DELAY).

@wterpstra wterpstra force-pushed the feat/enqueue-retry-policy branch from 83e63b4 to 56bf28a Compare December 1, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add retry policy for scan enqueuing to handle queue capacity limits

2 participants