Skip to content

Commit

Permalink
imapc-quota: Avoid sending unnecessarily many GETQUOTA[ROOT] commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed May 12, 2017
1 parent 5231ae5 commit dee1520
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/plugins/quota/quota-imapc.c
Expand Up @@ -346,6 +346,7 @@ static int imapc_quota_refresh_root(struct imapc_quota_root *root)
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 */
Expand All @@ -366,11 +367,14 @@ static int imapc_quota_refresh(struct imapc_quota_root *root)
return 0;
}

root->last_refresh = ioloop_timeval;
if (root->root_name == NULL)
return imapc_quota_refresh_mailbox(root);
ret = imapc_quota_refresh_mailbox(root);
else
return imapc_quota_refresh_root(root);
ret = imapc_quota_refresh_root(root);
/* set the last_refresh only after the refresh, because it changes
ioloop_timeval. */
root->last_refresh = ioloop_timeval;
return ret;
}

static int imapc_quota_init_limits(struct quota_root *_root)
Expand Down

0 comments on commit dee1520

Please sign in to comment.