Open dolphinsd opened 2 years ago
That is probably correct. Chance of collisions depends on number of existing entries and key length. It is compensated for somewhat in the code, but if you want a guarantee you could increase the count at https://github.com/tedd/Tedd.ShortUrl/blob/e845978589c8dda7066abb67c229cd95202b7238/src/Tedd.ShortUrl/Services/ShortUrlService.cs#L57 or even replace it with a while (true).
Come to think of it, I should probably make that a config option.
While GetRandomKey is random, will million requests we made as a test, we had a hit for duplicates!