]> git.sur5r.net Git - openldap/commitdiff
ITS#4308 fix cache flush task interval
authorHoward Chu <hyc@openldap.org>
Fri, 6 Jan 2006 03:51:56 +0000 (03:51 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 6 Jan 2006 03:51:56 +0000 (03:51 +0000)
servers/slapd/back-bdb/cache.c

index de2c35a6bf03b84f3c87ea52f6c484cc3ec6045d..e66836af61da8e28ef9f3c535282aa23d0cae40e 100644 (file)
@@ -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 );
                        }