aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-04-18 22:18:39 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-04-18 22:18:39 +0300
commit5e93c56acf080ef006176076be4efab4aa0591c0 (patch)
treece5a296fcbb5c47823e2ba3343b3673e7cc5d6b4 /src/wydawca.c
parent7c8140491ce8547fe45a791fb0a185817b5ff8ec (diff)
downloadwydawca-5e93c56acf080ef006176076be4efab4aa0591c0.tar.gz
wydawca-5e93c56acf080ef006176076be4efab4aa0591c0.tar.bz2
Fix statistics gathering. Display stats at the end of the run in cron mode.
* src/directive.c (process_directives): Raise the 'destroying' flag prior to removing the directive file, in order to avoid the removal being caught by the watcher thread. * src/timer.c (wydawca_stats_export, wydawca_stats_update): New functions. * src/triplet.c (triplet_list_lock,triplet_list_unlock): Check for NULL pointer. (remove_triplet_unlocked): Set the 'destroying' flag. (triplet_remove_file): Do nothing if the 'destroying' flag is set. (wy_thr_triplet): Call logstats only in the daemon mode. Otherwise call wydawca_stats_update. * src/wydawca.c (wy_main): Call wydawca_stats_export at the beginning. Call logstats before exiting, unless in daemon mode. * src/wydawca.h (struct wy_triplet): New member: destroying. (wydawca_stats_export,wydawca_stats_update): New protos. * tests/check-fail.at: Update. * tests/check-notify.at: Update. * tests/upl12f.at: Update.
Diffstat (limited to 'src/wydawca.c')
-rw-r--r--src/wydawca.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wydawca.c b/src/wydawca.c
index 31ca52d..09015c1 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -202,7 +202,7 @@ wy_stat_expansion(char **ret, char const *name, size_t len)
}
void
-logstats()
+logstats(void)
{
int i;
@@ -314,6 +314,7 @@ wy_main(void)
sigaddset(&sigs, SIGCHLD);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
+ wydawca_stats_export();
scan_all_spools();
if (wy_mode == WY_MODE_DAEMON) {
@@ -349,6 +350,7 @@ wy_main(void)
}
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
wy_triplet_wait();
+ logstats();
}
}

Return to:

Send suggestions and report system problems to the System administrator.