SEAPUNK / jobber

Simple job queue.
1 stars 0 forks source link

Job ID generation #1

Closed SEAPUNK closed 8 years ago

SEAPUNK commented 8 years ago

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.

SEAPUNK commented 8 years ago

OR, how about this for job ID generation:

The only time collision can happen is:

SEAPUNK commented 8 years ago

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.

SEAPUNK commented 8 years ago

See: #14 We're using UUIDs now.

SEAPUNK commented 8 years ago

UUIDs are perfectly fine.