Skip to content

Commit

Permalink
Merge branch 'master' of bobo:/data/philotic/repos/git/vendor/beanstalkd
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Rarick committed Dec 18, 2007
2 parents 60f7f7a + 72ec2f8 commit 2b6ea26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion doc/protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ It inserts a job into the queue.
After sending the command line and body, the client waits for a reply, which
may be:

- "INSERTED\r\n" to indicate success.
- "INSERTED <id>\r\n" to indicate success.

- <id> is the integer id of the new job

- "BURIED\r\n" if the priority queue data structure is full.

Expand Down
5 changes: 4 additions & 1 deletion prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ enqueue_incoming_job(conn c)
r = enqueue_job(j, j->delay);
put_ct++; /* stats */

if (r) return reply(c, MSG_INSERTED, MSG_INSERTED_LEN, STATE_SENDWORD);
if (r) {
r = snprintf(c->reply_buf, LINE_BUF_SIZE, MSG_INSERTED_FMT, j->id);
return reply(c, c->reply_buf, r, STATE_SENDWORD);
}

bury_job(j); /* there was no room in the queue, so it gets buried */
reply(c, MSG_BURIED, MSG_BURIED_LEN, STATE_SENDWORD);
Expand Down
3 changes: 1 addition & 2 deletions prot.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@
#define CMD_STATS_LEN CONSTSTRLEN(CMD_STATS)
#define CMD_JOBSTATS_LEN CONSTSTRLEN(CMD_JOBSTATS)

#define MSG_INSERTED "INSERTED\r\n"
#define MSG_FOUND "FOUND"
#define MSG_NOTFOUND "NOT_FOUND\r\n"
#define MSG_DELETED "DELETED\r\n"
#define MSG_RELEASED "RELEASED\r\n"
#define MSG_BURIED "BURIED\r\n"
#define MSG_INSERTED_FMT "INSERTED %llu\r\n"

#define MSG_INSERTED_LEN CONSTSTRLEN(MSG_INSERTED)
#define MSG_NOTFOUND_LEN CONSTSTRLEN(MSG_NOTFOUND)
#define MSG_DELETED_LEN CONSTSTRLEN(MSG_DELETED)
#define MSG_RELEASED_LEN CONSTSTRLEN(MSG_RELEASED)
Expand Down

0 comments on commit 2b6ea26

Please sign in to comment.