Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

The throttling middleware was not properly detecting test mode when tests ran through xvfb-run and poetry run in CI, causing rate limiting to trigger on the application's own pages during test execution.

Changes Made

Throttling Middleware (blt/middleware/throttling.py):

  • Updated test detection to use Django settings flags (IS_TEST and TESTING) instead of checking sys.argv
  • Removed unused sys import
- if "test" in sys.argv:
+ if getattr(settings, 'IS_TEST', False) or getattr(settings, 'TESTING', False):

Root Cause

The middleware was checking if "test" in sys.argv which is unreliable when tests run through xvfb-run and poetry run. Django's settings already have IS_TEST and TESTING flags that are properly set during test execution.

This ensures throttling is properly disabled during test runs, preventing rate limiting from affecting CI/CD test execution.

Original prompt

it looks like the github action test ci / cd optmized may be triggering the throttling again - we had fixed that in a previous PR - please fix it again


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 9, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

@DonnieBLT
Copy link
Collaborator

@copilot I mean the tests that we run against our own pages trigger the throttle - we had added throttling being exempt for tests but maybe there is something that got reverted with that - please focus on fixing that

Copilot AI changed the title [WIP] Fix throttling issue in GitHub action test CI/CD Remove poetry lock from CI to prevent PyPI throttling Nov 9, 2025
Copilot AI requested a review from DonnieBLT November 9, 2025 19:27
@github-actions github-actions bot added the files-changed: 2 PR changes 2 files label Nov 9, 2025
Copy link
Contributor Author

Copilot AI commented Nov 9, 2025

@copilot I mean the tests that we run against our own pages trigger the throttle - we had added throttling being exempt for tests but maybe there is something that got reverted with that - please focu...

Fixed in commit 8ff7557. The throttling middleware was checking sys.argv to detect test mode, which failed when tests ran through xvfb-run and poetry run. Updated to use Django's IS_TEST and TESTING settings flags instead, which are properly set during test execution.

Copilot AI changed the title Remove poetry lock from CI to prevent PyPI throttling Fix CI/CD throttling issues: Remove poetry lock and fix test exemption Nov 9, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot undo the changes to this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit 57b7074. The ci-cd.yml file has been restored to its original state with the poetry lock commands back in place.

Copilot AI changed the title Fix CI/CD throttling issues: Remove poetry lock and fix test exemption Fix CI/CD throttling issue: Fix test exemption in throttling middleware Nov 9, 2025
Copilot AI requested a review from DonnieBLT November 9, 2025 19:50
@DonnieBLT DonnieBLT marked this pull request as ready for review November 9, 2025 21:35
@DonnieBLT DonnieBLT merged commit d498e23 into main Nov 10, 2025
28 of 33 checks passed
@DonnieBLT DonnieBLT deleted the copilot/fix-throttling-issue branch November 10, 2025 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants