Open thejasmeetsingh opened 1 year ago
There exist 2^122 unique UUID4. Even on a database with billions of rows, the change of collision is negligible.
I think that the code in place is already an overkill; I doubt that this loop has ever had to try more than once.
Yeah, that's true. I think it was initially put in as a fail-safe. But it can be optimized. Do you want me to work on this small thing?
No, it is unnecessary. Unless you process billions of payments per seconds during several centuries, it is unlikely that you'll ever have a collision.
https://github.com/jazzband/django-payments/blob/7b23efdd36e6a1cdcf4e876caebce621565b8db2/payments/models.py#L118
Hey there, Can we add the current timestamp as well to the token string? UUID will give a unique value, but adding a timestamp can increase the probability that there will be fewer iterations and fewer chances that the program will encounter an infinite loop.
If you agree with the above observation, then please assign the issue to me! Thanks😊