* move initialization of context to the top
[citadel.git] / citadel / modules / expire / serv_expire.c
index ac1a6f8aadf44af7bd38c17f4d34f252c51b2b10..eaae100b38579389b35c6af2b7bd2af2e23f4a2d 100644 (file)
@@ -864,10 +864,9 @@ void *purge_databases(void *args)
         struct tm tm;
        struct CitContext purgerCC;
 
-       CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
-
        CtdlFillSystemContext(&purgerCC, "purger");
        citthread_setspecific(MyConKey, (void *)&purgerCC );
+       CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
 
         while (!CtdlThreadCheckStop()) {
                 /* Do the auto-purge if the current hour equals the purge hour,
@@ -945,6 +944,7 @@ void *purge_databases(void *args)
                        CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
 
         }
+       CtdlClearSystemContext();
         return NULL;
 }
 /*****************************************************************************/