[Answer]-Common celery workers for different clients having different DBs

1đź‘Ť

âś…

Eventually you will have duplicates. Many people ignore this issue because it is a “low probability”, and then are surprised when it hits them. And then a story leaks how someone was logged into another uses Facebook account. If you require them to always be unique then you will have to prefix each ID with something that will never repeat – like current date and time with microseconds.

And if that is not good enough, because there still is a even tinier chance of a collision, you can create a small application that will generate those prefixes, and will add an counter (incremented after each hash request, and reset every couple seconds) to the date and microseconds. It will have to work in single-threaded mode, but this will be a guarantee to generate unique prefixes that won’t collide.

👤Aida Paul

Leave a comment