summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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