chiark / gitweb /
do not debug log every filemon event
[inn-innduct.git] / backends / innduct.c
index af192db149f7952e768315f6d9d35e9de400935e..609cf7951f9e1fa3be9db346e61d5a2b8d11c27d 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]);
 }
 
@@ -2284,7 +2285,7 @@ static void *filemon_inotify_readable(oop_source *lp, int fd,
       die("inotify read %d bytes wanted struct of %d", r, (int)sizeof(iev));
     }
     InputFile *ipf= filemon_inotify_wd2ipf[iev.wd];
-    debug("filemon inotify readable read %p wd=%d", ipf, iev.wd);
+    /*debug("filemon inotify readable read %p wd=%d", ipf, iev.wd);*/
     filemon_callback(ipf);
   }
   return OOP_CONTINUE;
@@ -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);
 }