]> git.saurik.com Git - redis.git/commitdiff
Remove backgroud jobs from the queue only when the processing was completed, and...
authorantirez <antirez@gmail.com>
Thu, 15 Sep 2011 13:52:14 +0000 (15:52 +0200)
committerantirez <antirez@gmail.com>
Thu, 15 Sep 2011 16:21:27 +0000 (18:21 +0200)
src/bio.c

index 145a2324f30333052ebe02d9217ca31c7b9e5c53..1657455eb26f460a9945f6b682494d0da1a0585f 100644 (file)
--- a/src/bio.c
+++ b/src/bio.c
@@ -118,7 +118,6 @@ void *bioProcessBackgroundJobs(void *arg) {
         /* Pop the job from the queue. */
         ln = listFirst(bio_jobs[type]);
         job = ln->value;
-        listDelNode(bio_jobs[type],ln);
         /* It is now possible to unlock the background system as we know have
          * a stand alone job structure to process.*/
         pthread_mutex_unlock(&bio_mutex[type]);
@@ -134,6 +133,7 @@ void *bioProcessBackgroundJobs(void *arg) {
         /* Lock again before reiterating the loop, if there are no longer
          * jobs to process we'll block again in pthread_cond_wait(). */
         pthread_mutex_lock(&bio_mutex[type]);
+        listDelNode(bio_jobs[type],ln);
         bio_pending[type]--;
     }
 }