Skip to content

Conversation

@ericy1000
Copy link

#77
Per submitted issue, making the api_name unique through combination of datetime and random number will significantly reduce the chances of collision (aka same api_name)

Problem: When you utilize concurrent.futures as part of POC from #6 , the delete_gateway behavior will delete all ApiGateways with matching api_name. The api_name is just the site name and appended " - IP Rotate API" label. If you create multiple ApiGateways to same site, the delete behavior deletes all ApiGateways as they would all have the same api_name.

I do not believe having the same api_name causes issues when creating new ApiGateways as I believe I've seen multiple ApiGateways when viewing in AWS console. The deletion is the only issue.

Solution: By appending a datetime and random number from 0 to 99999, any collisions from matching api names should all but be eliminated (If you created 25 ApiGateway at the exact same second, the odds of any matching API names is 0.3%. Pair that with the odds that all 25 Gateways would be created at the exact same second, the odds get even lower of collision.

ericy1000 added 3 commits May 2, 2025 21:16
…me_suffix

Made changes to code per discussion in issue
Such that
Simplify - no datetime needed to be imported; people are free to set the api_name_suffix however they want. It defaults to the previous suffix of " - IP Rotate API"
Backward Compatible - api_name_suffix is prepopulated with the same suffix as before so it doesn't break any existing method calls
Greater Flexibility - by making the api_name_suffix a string argument, folks can add whaatever they want. If they want a random suffix, great. If they want to call it something else, they can as well. The world is their oyster.
@ericy1000 ericy1000 closed this May 3, 2025
@ericy1000 ericy1000 reopened this May 3, 2025
@ericy1000
Copy link
Author

@Ge0rg3 any issues with accepting the PR?
Eager to be able to use the updated library in my code as I'm currently limited to one worker unless I do a refactor on my code (my code wasn't original built for async or sharing a requests.Session across multiple threads).

I made it better than my original PR:
Simplify - no datetime needed to be imported; people are free to set the api_name_suffix however they want. It defaults to the previous suffix of " - IP Rotate API"
Backward Compatible - api_name_suffix is prepopulated with the same suffix as before so it doesn't break any existing method calls
Greater Flexibility - by making the api_name_suffix a string argument, folks can add whatever they want. If they want a random suffix, great. If they want to call it something else, they can as well. The world is their oyster.

@Ge0rg3
Copy link
Owner

Ge0rg3 commented May 6, 2025

Hey @ericy1000, will check this before end of week

@ericy1000
Copy link
Author

ericy1000 commented May 6, 2025

Thank you; should be an easy code review
The final version only changes 3 lines of code (1 of which just increments the version number)

Thank you again for putting together this library!

@ericy1000
Copy link
Author

Any chance to review this, @Ge0rg3 ?

Thank you

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.

2 participants