Skip to content

Commit

Permalink
lib-index: limit mail_index error prints to one per ioloop_time
Browse files Browse the repository at this point in the history
This is to prevent log flooding.
  • Loading branch information
mrannanj authored and sirainen committed Sep 9, 2016
1 parent 4148574 commit 7963367
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib-index/mail-index-private.h
Expand Up @@ -215,6 +215,7 @@ struct mail_index {
ARRAY(union mail_index_module_context *) module_contexts;

char *error;
time_t last_error_time;
unsigned int nodiskspace:1;
unsigned int index_lock_timeout:1;

Expand Down
5 changes: 4 additions & 1 deletion src/lib-index/mail-index.c
Expand Up @@ -753,7 +753,10 @@ void mail_index_set_error(struct mail_index *index, const char *fmt, ...)
index->error = i_strdup_vprintf(fmt, va);
va_end(va);

i_error("%s", index->error);
if (ioloop_time != index->last_error_time) {
index->last_error_time = ioloop_time;
i_error("%s", index->error);
}
}
}

Expand Down

0 comments on commit 7963367

Please sign in to comment.