Mercurial > dovecot > core-2.2
changeset 22039:cd2b83cf966e
imapc-quota: Avoid sending unnecessarily many GETQUOTA[ROOT] commands
The last_refresh == ioloop_timeval check didn't work, because the refresh
itself updated ioloop_timeval. This caused a single quota lookup to issue
multiple GETQUOTA[ROOT] commands to imapc.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 12 May 2017 15:42:31 +0300 |
parents | 801fd8985a0b |
children | 99752d3e656b |
files | src/plugins/quota/quota-imapc.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota-imapc.c Wed May 10 12:44:25 2017 +0300 +++ b/src/plugins/quota/quota-imapc.c Fri May 12 15:42:31 2017 +0300 @@ -346,6 +346,7 @@ static int imapc_quota_refresh(struct imapc_quota_root *root) { enum imapc_capability capa; + int ret; if (root->imapc_ns == NULL) { /* imapc namespace is missing - disable this quota backend */ @@ -366,11 +367,14 @@ return 0; } + if (root->root_name == NULL) + ret = imapc_quota_refresh_mailbox(root); + else + ret = imapc_quota_refresh_root(root); + /* set the last_refresh only after the refresh, because it changes + ioloop_timeval. */ root->last_refresh = ioloop_timeval; - if (root->root_name == NULL) - return imapc_quota_refresh_mailbox(root); - else - return imapc_quota_refresh_root(root); + return ret; } static int imapc_quota_init_limits(struct quota_root *_root)