aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2015-06-19 15:00:42 +0200
committerGravatar Christian Hesse <mail@eworm.de>2015-06-19 15:00:42 +0200
commit493b81ead774a72bcf99d74a408db4aefa74f1b3 (patch)
tree9c19a2ec13a8d7ab98df57450ca0dc4bcae502f5
parent4007862e9f521cefed577e68bf9fc5df9b28085e (diff)
downloadjournal-notify-493b81ead774a72bcf99d74a408db4aefa74f1b3.tar.gz
journal-notify-493b81ead774a72bcf99d74a408db4aefa74f1b3.tar.zst
show a notification when throttling takes effect
-rw-r--r--journal-notify.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/journal-notify.c b/journal-notify.c
index cdbcac0..8e68ea2 100644
--- a/journal-notify.c
+++ b/journal-notify.c
@@ -259,14 +259,20 @@ int main(int argc, char **argv) {
gettimeofday(&tv_now, NULL);
if (tv_now.tv_sec == tv_last.tv_sec) {
+ notification_count++;
if (notification_count >= 5) {
- fprintf(stderr, "Already showed five notifications, ignoring!\n");
+ if (verbose)
+ fprintf(stderr, "Already showed %u notifications, throttling!\n", notification_count);
+ if (executeonly == 0 && notification_count == 5) {
+ if ((rc = notify(program, "Throttling notification! View your journal for complete log.", 0, "dialog-warning", timeout)) > 0) {
+ fprintf(stderr, "Failed to show notification.\n");
+ }
+ }
continue;
}
- notification_count++;
} else {
tv_last = tv_now;
- notification_count = 1;
+ notification_count = 0;
}
/* Looks like there is a bug in libsystemd journal handling