From 2ab46c4a237b9d9614dd655fcf0078b68fd4581b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 3 May 2010 12:24:37 +0100 Subject: [PATCH] better logging of manual flush --- backends/innduct.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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); } -- 2.30.2