Skip to content

Commit

Permalink
Use A for reserved Message ID byte.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Dec 7, 2015
1 parent 5c4c863 commit fe18eb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* An ID is 42 byes string composed as such:
*
* +--+-----------------+-+--------------------- --------+-+-----+--+
* |D-| 8 bytes Node ID |-| 144-bit ID (base64: 24 bytes)|-| TTL |0$|
* |D-| 8 bytes Node ID |-| 144-bit ID (base64: 24 bytes)|-| TTL |A$|
* +--+-----------------+-+------------------------------+-+-----+--+
*
* "D-" is just a fixed string. All Disque job IDs start with this
Expand All @@ -71,10 +71,12 @@
* This is useful since the receiver of an ACKJOB command can avoid
* creating a "dummy ack" for unknown job IDs for at most once jobs.
*
* The final sequence "0$" has the following use:
* The final sequence "A$" has the following use:
*
* "0" is reserved for future uses, so clients should never assume that
* this byte will be set to a specific value.
* "A" is reserved for future uses, so clients should never assume that
* this byte will be set to a specific value. It is set to "A" since it
* is the logical zero from the point of view of the base64 encoding we
* use.
*
* "$" is just a fixed string that marks the end of the Dique ID.
*/
Expand Down Expand Up @@ -133,7 +135,7 @@ void generateJobID(char *id, int ttl, int retry) {
id[3] = hexcset[ttlbytes[1]&0xf];
id += 4;

*id++ = '0'; /* Reserved for future uses. */
*id++ = 'A'; /* Reserved for future uses. */
*id++ = '$';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cluster/tests/02-jobs-replication.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ for {set j 1} {$j <= 3} {incr j} {
# nodes before the timeout.
set max_possible_repl [expr {$::instances_count-3}]
catch {D 0 addjob myqueue myjob 5000 replicate $max_possible_repl} job_id
assert_match {DI*} $job_id
assert_match {D-*} $job_id
restart_instance disque 1
restart_instance disque 2
restart_instance disque 3
Expand Down

0 comments on commit fe18eb3

Please sign in to comment.