chiark / gitweb /
better logging of manual flush
authorIan Jackson <ian@chiark.greenend.org.uk>
Mon, 3 May 2010 11:24:37 +0000 (12:24 +0100)
committerIan Jackson <ian@chiark.greenend.org.uk>
Mon, 3 May 2010 11:24:37 +0000 (12:24 +0100)
backends/innduct.c

index af192db149f7952e768315f6d9d35e9de400935e..b86b1bef644a0b085560dac13cddb5a827ca4980 100644 (file)
@@ -323,7 +323,8 @@ static void statemc_setstate(StateMachineState newsms, int periods,
 
 static void statemc_start_flush(const char *why); /* Normal => Flushing */
 static void spawn_inndcomm_flush(const char *why); /* Moved => Flushing */
-static int trigger_flush_ok(void); /* => Flushing,FLUSHING, ret 1; or ret 0 */
+static int trigger_flush_ok(const char *why /* 0 means timeout */);
+                                  /* => Flushing,FLUSHING, ret 1; or ret 0 */
 
 static void article_done(Article *art, int whichcount);
 
@@ -855,7 +856,7 @@ CCMD(help) {
 }
 
 CCMD(flush) {
-  int ok= trigger_flush_ok();
+  int ok= trigger_flush_ok("manual request");
   if (!ok) fprintf(cc->out,"already flushing (state is %s)\n", sms_names[sms]);
 }
 
@@ -2640,20 +2641,21 @@ static void statemc_start_flush(const char *why) { /* Normal => Flushing */
   spawn_inndcomm_flush(why); /* => Flushing FLUSHING */
 }
 
-static int trigger_flush_ok(void) { /* => Flushing,FLUSHING, ret 1; or ret 0 */
+static int trigger_flush_ok(const char *why) {
   switch (sms) {
 
   case sm_NORMAL:
-    statemc_start_flush("periodic"); /* Normal => Flushing; => FLUSHING */
-    return 1;
+    statemc_start_flush(why ? why : "periodic");
+    return 1;                           /* Normal => Flushing; => FLUSHING */
 
   case sm_FLUSHFAILED:
-    spawn_inndcomm_flush("retry"); /* Moved => Flushing; => FLUSHING */
-    return 1;
+    spawn_inndcomm_flush(why ? why : "retry");
+    return 1;                            /* Moved => Flushing; => FLUSHING */
 
   case sm_SEPARATED:
   case sm_DROPPING:
-    warn("took too long to complete old feedfile after flush, autodeferring");
+    warn("abandoning old feedfile after flush (%s), autodeferring",
+        why ? why : "took too long to complete");
     assert(flushing_input_file);
     autodefer_input_file(flushing_input_file);
     return 1;
@@ -2669,7 +2671,7 @@ static void statemc_period_poll(void) {
   assert(until_flush>=0);
 
   if (until_flush) return;
-  int ok= trigger_flush_ok();
+  int ok= trigger_flush_ok(0);
   assert(ok);
 }