Skip to content

Commit

Permalink
Delayed jobs are now included in the delete protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfelt authored and kr committed Sep 25, 2011
1 parent cb16211 commit b5a2049
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doc/protocol.txt
Expand Up @@ -245,8 +245,8 @@ RESERVED <id> <bytes>\r\n

The delete command removes a job from the server entirely. It is normally used
by the client when the job has successfully run to completion. A client can
delete jobs that it has reserved, ready jobs, and jobs that are buried. The
delete command looks like this:
delete jobs that it has reserved, ready jobs, delayed jobs, and jobs that are
buried. The delete command looks like this:

delete <id>\r\n

Expand Down
12 changes: 11 additions & 1 deletion prot.c
Expand Up @@ -607,6 +607,15 @@ remove_buried_job(job j)
return j;
}

static job
remove_delayed_job(job j)
{
if (!j || j->r.state != Delayed) return NULL;
heapremove(&j->tube->delay, j->heap_index);

return j;
}

static job
remove_ready_job(job j)
{
Expand Down Expand Up @@ -1278,7 +1287,8 @@ dispatch_cmd(conn c)
j = job_find(id);
j = remove_reserved_job(c, j) ? :
remove_ready_job(j) ? :
remove_buried_job(j);
remove_buried_job(j) ? :
remove_delayed_job(j);

if (!j) return reply(c, MSG_NOTFOUND, MSG_NOTFOUND_LEN, STATE_SENDWORD);

Expand Down

0 comments on commit b5a2049

Please sign in to comment.