Collision/ Duplicate Ids getting Generated In our Production with this module
pssvenkatrao opened this issue · comments
pssvenkatrao commented
I am using the default setting
shortid.characters("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_");
shortid.generate().substring(0, 5);
I am seeing the duplicate IDs generating and resulting in failure when I have short id as unique index while saving in DB.
We are running the code in 5 PODs in each of kubernetes clusters.. Please suggest.
Andrey Sitnik commented
shortid
is deprecated. Use Nano ID.- 5 symbols are not enough to prevent collisions in complex systems.
- Here is ID length and collisions calculator to choose the best length for you.