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

Increase Short URL key entropy to decrease likelihood of key collisions #291

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

Conversation

stevebauman
Copy link
Contributor

This is related to PR #290, but is a slimmer approach to decreasing the likelihood of collisions. This means that two or more queued jobs attempting to create Short URL's at the same time will have to execute at the same microsecond to generate the same short URL key (very unlikely).

@stevebauman stevebauman changed the title Increase entropy to decrease likelihood of collisions Increase Short URL key entropy to decrease likelihood of key collisions Jul 23, 2024
@ash-jc-allen
Copy link
Owner

Hey @stevebauman! Sorry for not checking this one out yet. Last week was crazy busy! But I'm hoping to check it out this week 😄

@stevebauman
Copy link
Contributor Author

Hey man no worries at all! In no rush as I was already able to make this change in production (appreciate you making this customizable!), take your time 🙏

@ash-jc-allen
Copy link
Owner

Hey @stevebauman! I've been looking at this and I can't make my mind up on something, so I'm hoping you'll be able to advise me. Do you think this would be better as the default generator? Or do you think this should be added as a separate generator class (that someone could then just set via the config)?

I feel like the existing generator logic has worked pretty well for a large majority of applications for the past few years. So I don't know if it should be left as the default. Or, maybe your new logic should become the default if it's not going to affect any existing apps? In my mind, if a dev using the package doesn't notice any difference in the keys being generated, that's perfect for me! I'm just scared of disrupting any existing apps haha 😄

@stevebauman
Copy link
Contributor Author

Hey @ash-jc-allen !

Totally understandable. I think adding it as a separate generator as you mentioned may be the better choice to avoid any possible disruption to existing production applications.

Maybe we should add a note to the readme to possibly enable this generator in situations of creating short URLs in queued jobs to prevent the likelihood of collisions?

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