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

Facing "You have exceeded a secondary rate limit" when trying to clean deployments up #41

Open
vmartysh opened this issue Nov 7, 2023 · 3 comments

Comments

@vmartysh
Copy link

vmartysh commented Nov 7, 2023

I have like 460 deployments and that is probably the reason I'm getting

"Error: You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID ..."

I think it is a good idea to add an option for user to:

  1. Add an option for user to be able to limit the number of deployments he wants to delete (like 10 or 50 etc..)
  2. maybe also add some timeouts to avoid hitting this rate limit.

Because currently it is impossible to use this action in case you have a large number of deployments (which is actually one of the use cases).

@asheeque
Copy link

Can you suggest a solution for this problem

@strumwolf
Copy link
Owner

PR's are welcome. I currently don't have time to add rate limiting but will look to in the future.

@Aetherinox
Copy link

Aetherinox commented Oct 15, 2024

If the developer would like, I wrote some edits to the script to add delays. I can add a limit to the number of deployments to delete (added), but I modified the promises for deleteDeploymentById and setDeploymentInactive both have a delay now.

Before I was hitting the limit every 100 actions, I just deleted 640 deployments in a single run.

Then I just added a new var

              with:
                  token: ${{ secrets.GITHUB_TOKEN }}
                  environment: test-remove-deployment-ref-only
                  onlyRemoveDeployments: true
                  delay: "500"

Timestamped to test

 › 🛫 Starting Deployment Deletion action
   › 📋 Collect list of deployments
      › 📝 Searching env test-remove-deployment-ref-only
      › ⚙️ Using default limit of 100
      › 📚 Finished fetching deployment results
      › 🔍 Found 6 deployments for ref main
   › 🔴 Deactivating deployment ref main in env test-remove-deployment-ref-only
      › ✔️ ID 1880196053 inactive - T16:41:15.294Z
      › ✔️ ID 1880196011 inactive - T16:41:15.792Z
      › ✔️ ID 1880195955 inactive - T16:41:16.289Z
      › ✔️ ID 1880195906 inactive - T16:41:16.791Z
      › ✔️ ID 1880195843 inactive - T16:41:17.287Z
   › 🗑️ Deleting deployment ref main in env test-remove-deployment-ref-only
      › ✔️ ID 1880196053 deleted
      › ✔️ ID 1880196011 deleted
      › ✔️ ID 1880195955 deleted
      › ✔️ ID 1880195906 deleted
      › ✔️ ID 1880195843 deleted

Of course 500ms is quite long, but it can be set way lower. Just wanted to ensure it was properly firing. Also created a new test to create 10 deployments for the env and ensure they are deleted.

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

No branches or pull requests

4 participants