Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: remove 500 ms debounce on IMAP IDLE notifications #216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib-storage/mail-storage-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ struct mailbox {
/* Mailbox notification settings: */
mailbox_notify_callback_t *notify_callback;
void *notify_context;
struct timeout *to_notify, *to_notify_delay;
struct timeout *to_notify;
struct mailbox_notify_file *notify_files;

/* Increased by one for each new struct mailbox. */
Expand Down
21 changes: 4 additions & 17 deletions src/lib-storage/mailbox-watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <fcntl.h>
#include <sys/stat.h>

#define NOTIFY_DELAY_MSECS 500

struct mailbox_notify_file {
struct mailbox_notify_file *next;

Expand All @@ -19,9 +17,10 @@ struct mailbox_notify_file {
struct io *io_notify;
};

static void notify_delay_callback(struct mailbox *box)
static void notify_callback(struct mailbox *box)
{
timeout_remove(&box->to_notify_delay);
timeout_reset(box->to_notify);

box->notify_callback(box, box->notify_context);
}

Expand All @@ -40,18 +39,7 @@ static void notify_timeout(struct mailbox *box)
}

if (notify)
notify_delay_callback(box);
}

static void notify_callback(struct mailbox *box)
{
timeout_reset(box->to_notify);

if (box->to_notify_delay == NULL) {
box->to_notify_delay =
timeout_add_short(NOTIFY_DELAY_MSECS,
notify_delay_callback, box);
}
notify_callback(box);
}

void mailbox_watch_add(struct mailbox *box, const char *path)
Expand Down Expand Up @@ -97,7 +85,6 @@ void mailbox_watch_remove_all(struct mailbox *box)
i_free(file);
}

timeout_remove(&box->to_notify_delay);
timeout_remove(&box->to_notify);
}

Expand Down