Skip to content

Commit d8b1047

Browse files
committed
flag crawler as running during the request to run
... so there's no race to tell if it's running if you check after the command exits.
1 parent 9d635fa commit d8b1047

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

items.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,6 @@ static void *item_crawler_thread(void *arg) {
769769
fprintf(stderr, "Starting LRU crawler background thread\n");
770770
while (do_run_lru_crawler_thread) {
771771
pthread_cond_wait(&lru_crawler_cond, &lru_crawler_lock);
772-
STATS_LOCK();
773-
stats.lru_crawler_running = true;
774-
STATS_UNLOCK();
775772

776773
while (crawler_count) {
777774
item *search = NULL;
@@ -918,6 +915,9 @@ enum crawler_result_type lru_crawler_crawl(char *slabs) {
918915
}
919916
pthread_mutex_unlock(&cache_lock);
920917
pthread_cond_signal(&lru_crawler_cond);
918+
STATS_LOCK();
919+
stats.lru_crawler_running = true;
920+
STATS_UNLOCK();
921921
pthread_mutex_unlock(&lru_crawler_lock);
922922
return CRAWLER_OK;
923923
}

0 commit comments

Comments
 (0)