Closed SEAPUNK closed 8 years ago
OR, how about this for job ID generation:
Date.now()
that is kept for the duration of the program.The only time collision can happen is:
Okay, I will make Job ID generation like this for now (changing the generator, until we finally add solid job storage, will not be a breaking change):
Date.now()
, stored at time of manager creation (no waiting of 1ms), with a counter.
See: #14 We're using UUIDs now.
UUIDs are perfectly fine.
Ignore the babble, I'm using UUIDs now
Job IDs will be done by an ID broker (which is the manager) to prevent race conditions. The Job ID format should be Date.now() + counter. The counter resets to 0 every time the Date.now() time changes, so you can have multiple jobs created in the same ms. Date.now() will be a good safeguard in the sense of if we do not "store" job IDs, we will not need to keep track of collisions.