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

Clean up redirect IDs & forwarding logic #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

cdl
Copy link

@cdl cdl commented Jun 22, 2023

This PR aims to clean up the logic for our redirects.

The main change is a fairly low-risk refactor. Instead of two separate arrays and needing to ensure you don't end up off-by-one, we can instead use a hash and use Object.keys() and Object.values() to compose the resulting arrays.

The second commit updates the redirect logic to instead look at the final segment of the URL to find the ID, instead of looping through every ID and then .indexOf()-ing the URL. This reduces the time complexity of the lookup and should make all redirects equally fast. Right now, later redirects take longer to perform due to looping through the older redirects first.

@cdl
Copy link
Author

cdl commented Jun 22, 2023

We should maybe gate these changes behind a query parameter. This will allow us to deploy this change & confidently validate that the new logic does not regress the existing redirects, before effecting 100% of redirects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant