aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--journal-notify.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/journal-notify.c b/journal-notify.c
index 8e68ea2..2d425be 100644
--- a/journal-notify.c
+++ b/journal-notify.c
@@ -258,19 +258,7 @@ 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) {
- 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;
- }
- } else {
+ if (tv_now.tv_sec != tv_last.tv_sec) {
tv_last = tv_now;
notification_count = 0;
}
@@ -313,6 +301,19 @@ int main(int argc, char **argv) {
printf("Received message from journal: %s\n", message);
if (have_regex == 0 || regexec(&regex, message, 0, NULL, 0) == 0) {
+ /* throttling */
+ notification_count++;
+ if (notification_count >= 6) {
+ if (verbose)
+ fprintf(stderr, "Already showed %u notifications, throttling!\n", notification_count - 1);
+ if (executeonly == 0 && notification_count == 6) {
+ 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;
+ }
+
/* show notification */
if (executeonly == 0) {
for (i = 0; i < 3; i++) {