From: Howard Chu Date: Fri, 6 Jan 2006 03:51:56 +0000 (+0000) Subject: ITS#4308 fix cache flush task interval X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~455 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e82ce6444cf5c89d708eb96d9b14be654e8cf846;p=openldap ITS#4308 fix cache flush task interval --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index de2c35a6bf..e66836af61 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -643,11 +643,18 @@ bdb_cache_lru_add( ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex ); if ( bdb->bi_cache_task ) { if ( !ldap_pvt_runqueue_isrunning( &slapd_rq, - bdb->bi_cache_task )) + bdb->bi_cache_task )) { + struct re_s *task = bdb->bi_cache_task; + + /* We want it to start right now */ + task->interval.tv_sec = 0; ldap_pvt_runqueue_resched( &slapd_rq, bdb->bi_cache_task, 0 ); + /* But don't try to reschedule it while it's running */ + task->interval.tv_sec = 3600; + } } else { - bdb->bi_cache_task = ldap_pvt_runqueue_insert( &slapd_rq, 0, + bdb->bi_cache_task = ldap_pvt_runqueue_insert( &slapd_rq, 3600, bdb_cache_lru_purge, bdb, "bdb_cache_lru_purge", bdb->bi_dbenv_home ); }