]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/housekeeping.c
Additional memory allocated since startup: %d bytes message now identical to other...
[citadel.git] / citadel / server / housekeeping.c
index 4f8b1a9d99596304e758f3436e685f9701ad4bce..a5daff9f0ae221a0815eb2714e51e63000d40e5c 100644 (file)
@@ -4,7 +4,6 @@
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
-// The program is distributed without any warranty, expressed or implied.
 
 
 #include <stdio.h>
@@ -72,7 +71,7 @@ void check_ref_counts(void) {
 void keep_an_eye_on_memory_usage(void) {
        static void *original_brk = NULL;
        if (!original_brk) original_brk = sbrk(0);      // Remember the original program break so we can test for leaks
-       syslog(LOG_DEBUG, "original_brk=%lx, current_brk=%lx, addl=%ld", (long)original_brk, (long)sbrk(0), (long)(sbrk(0)-original_brk));      // FIXME not so noisy please
+       syslog(LOG_DEBUG, "Additional memory allocated since startup: %d bytes", (sbrk(0)-original_brk));
 }
 
 
@@ -89,7 +88,7 @@ void do_housekeeping(void) {
        int do_perminute_housekeeping_now = 0;
        time_t now;
 
-       if (housekeeping_disabled) {
+       if ( (housekeeping_disabled) || (housekeeping_in_progress) ) {
                return;
        }
 
@@ -104,8 +103,8 @@ void do_housekeeping(void) {
        end_critical_section(S_HOUSEKEEPING);
 
        now = time(NULL);
-       if ( (do_housekeeping_now == 0) && (!CtdlIsSingleUser()) ) {
-               if ( (now - last_timer) > (time_t)300 ) {
+       if ( (do_housekeeping_now == 0) && (!CtdlIsSingleUser()) && ((now - last_timer) > (time_t)3600) ) {
+               if ( (now - last_timer) > (time_t)3600 ) {
                        syslog(LOG_WARNING,
                                "housekeeping: WARNING: housekeeping loop has not run for %ld minutes.  Is something stuck?",
                                ((now - last_timer) / 60)
@@ -114,6 +113,10 @@ void do_housekeeping(void) {
                return;
        }
 
+       if (!do_housekeeping_now) {
+               return;
+       }
+
        // Ok, at this point we've made the decision to run the housekeeping
        // loop.  Everything below this point is real work.
 
@@ -125,6 +128,7 @@ void do_housekeeping(void) {
        // First, do the "as often as needed" stuff...
        JournalRunQueue();
        PerformSessionHooks(EVT_HOUSE);
+       cdb_tick();
 
        // Then, do the "once per minute" stuff...
        if (do_perminute_housekeeping_now) {