Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7292:d0520bb9177f HEAD
mailbox_notify_changes(): Don't trigger the timeout once a second to see if
the timeout really occurred.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 25 Feb 2008 21:47:17 +0200 |
parents | db65d921b0e1 |
children | f78b83bf16b7 |
files | src/lib-storage/index/index-mailbox-check.c src/lib-storage/index/index-sync.c |
diffstat | 2 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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,17 +25,8 @@ { 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) { if (stat(file->path, &st) == 0 && @@ -54,7 +45,8 @@ 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 @@ /* 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)
--- 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 @@ 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; }