dovecot-1.1: mailbox_notify_changes(): Don't trigger the timeout...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 25 21:45:05 EET 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/d0520bb9177f
changeset: 7292:d0520bb9177f
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 25 21:47:17 2008 +0200
description:
mailbox_notify_changes(): Don't trigger the timeout once a second to see if
the timeout really occurred.
diffstat:
2 files changed, 9 insertions(+), 12 deletions(-)
src/lib-storage/index/index-mailbox-check.c | 19 +++++++------------
src/lib-storage/index/index-sync.c | 2 ++
diffs (56 lines):
diff -r db65d921b0e1 -r d0520bb9177f src/lib-storage/index/index-mailbox-check.c
--- a/src/lib-storage/index/index-mailbox-check.c Mon Feb 25 21:38:58 2008 +0200
+++ b/src/lib-storage/index/index-mailbox-check.c Mon Feb 25 21:47:17 2008 +0200
@@ -25,16 +25,7 @@ static void check_timeout(struct index_m
{
struct index_notify_file *file;
struct stat st;
- time_t last_check;
bool notify;
-
- /* check changes only when we can also notify of new mail */
- last_check = I_MAX(ibox->sync_last_check, ibox->notify_last_check);
- if ((unsigned int)(ioloop_time - last_check) <
- ibox->box.notify_min_interval)
- return;
-
- ibox->notify_last_check = ioloop_time;
notify = ibox->notify_pending;
for (file = ibox->notify_files; file != NULL; file = file->next) {
@@ -54,7 +45,8 @@ static void check_timeout(struct index_m
static void notify_callback(struct index_mailbox *ibox)
{
- ibox->notify_last_check = ioloop_time;
+ timeout_reset(ibox->notify_to);
+
/* don't notify more often than once a second */
if (ioloop_time > ibox->notify_last_sent) {
ibox->notify_last_sent = ioloop_time;
@@ -91,8 +83,11 @@ void index_mailbox_check_add(struct inde
/* we still add a timeout if we don't have one already,
* because we don't know what happens with [di]notify
* when the filesystem is remote (NFS, ...) */
- if (ibox->notify_to == NULL)
- ibox->notify_to = timeout_add(1000, check_timeout, ibox);
+ if (ibox->notify_to == NULL) {
+ ibox->notify_to =
+ timeout_add(ibox->box.notify_min_interval * 1000,
+ check_timeout, ibox);
+ }
}
void index_mailbox_check_remove_all(struct index_mailbox *ibox)
diff -r db65d921b0e1 -r d0520bb9177f src/lib-storage/index/index-sync.c
--- a/src/lib-storage/index/index-sync.c Mon Feb 25 21:38:58 2008 +0200
+++ b/src/lib-storage/index/index-sync.c Mon Feb 25 21:47:17 2008 +0200
@@ -27,6 +27,8 @@ bool index_mailbox_want_full_sync(struct
ioloop_time < ibox->sync_last_check + MAILBOX_FULL_SYNC_INTERVAL)
return FALSE;
+ if (ibox->notify_to != NULL)
+ timeout_reset(ibox->notify_to);
ibox->sync_last_check = ioloop_time;
return TRUE;
}
More information about the dovecot-cvs
mailing list