Closed bermi closed 10 years ago
@bermi what you wrote up is just UNIX time... not IDs
@bermi check this http://3v4l.org/0MP6t
@sschiau you're right I messed the implementation! http://3v4l.org/LbspE shows a different ID.
I was under the impression that "Directly Sortable" on Particle (and twitter snowflake's) behaved the same way as flake-idgen, where their decimal representation of id's is sortable.
Is there a way to get a sortable ID using Particle?
@bermi the last revision fixes that problem https://github.com/sschiau/Particle/tree/ff9ab56e92931194c00433f63699cfc094025006
After running the following test http://3v4l.org/eHKCc and getting the following output for 5.5.3 (and other versions)
It looks like Particle will:
Using usleep(1000) between calls could prevent the same id's when running on the same process, but does not prevent two processes on the same machine from producing the same ID.
It looks like some implementations like https://github.com/T-PWK/flake-idgen are using a worker id, which could potentially be the pid of the process. This could solve the same server different process issue.
But the $machine_id issue seems like a bug to me unless I'm not using Particle correctly.
Are these known issues? Can they be addressed/prevented? Could the docs include details about these limitations?
Thanks