polluterofminds / graphite-blockstack

26 stars 4 forks source link

Bug: Document IDs are randomly generated and can, in theory lead to duplicate IDs for a document #1

Closed polluterofminds closed 6 years ago

polluterofminds commented 6 years ago

Example:

Using Math.random() as a baseline to generate the document ID means that even with unlimited document ID possibilities, the randomly generated ID could end up being the same as an existing document. The better method is something like:

-Create Random ID for first doc -All subsequent documents should be random +1 (or something similar).

polluterofminds commented 6 years ago

Quick fix: use Date.now() to generate the ID since this will update every millisecond.

polluterofminds commented 6 years ago

Verified this fix in production. Closing.