From 9eca89acc8638d08135c1d4a9dc7e73b993934e3 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 9 Feb 2006 07:02:40 +0000 Subject: [PATCH] Improve prev commit --- servers/slapd/back-bdb/cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 5f095e3a2a..1fdeafda92 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -642,6 +642,7 @@ bdb_cache_lru_add( rtask.arg = bdb; bdb_cache_lru_purge( NULL, &rtask ); } else { + int wake = 0; ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex ); if ( bdb->bi_cache_task ) { if ( !ldap_pvt_runqueue_isrunning( &slapd_rq, @@ -652,14 +653,18 @@ bdb_cache_lru_add( 0 ); /* But don't try to reschedule it while it's running */ bdb->bi_cache_task->interval.tv_sec = 3600; + wake = 1; } } else { bdb->bi_cache_task = ldap_pvt_runqueue_insert( &slapd_rq, 3600, bdb_cache_lru_purge, bdb, "bdb_cache_lru_purge", bdb->bi_dbenv_home ); + wake = 1; } ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex ); - slap_wake_listener(); + /* Don't bother waking if the purge task is already running */ + if ( wake ) + slap_wake_listener(); } } } -- 2.39.5