Permalink
Browse files

Delayed jobs are now included in the delete protocol.

  • Loading branch information...
1 parent cb16211 commit b5a20491fda42ad68de55914762c1b7c369c923a @dolfelt dolfelt committed with Aug 11, 2011
Showing with 13 additions and 3 deletions.
  1. +2 −2 doc/protocol.txt
  2. +11 −1 prot.c
View
@@ -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
View
12 prot.c
@@ -608,6 +608,15 @@ remove_buried_job(job 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)
{
if (!j || j->r.state != Ready) return NULL;
@@ -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);

0 comments on commit b5a2049

Please sign in to comment.