From: Ian Jackson Date: Mon, 3 May 2010 11:24:37 +0000 (+0100) Subject: better logging of manual flush X-Git-Tag: innduct-0.1~57^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=commitdiff_plain;h=2ab46c4a237b9d9614dd655fcf0078b68fd4581b better logging of manual flush --- diff --git a/backends/innduct.c b/backends/innduct.c index af192db..b86b1be 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -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); }