Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7011:71b9541adad1 HEAD
Quota warnings may have been triggered too early.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 21 Dec 2007 18:40:10 +0200 |
parents | e78c47c6ee8e |
children | 2f25031c4a84 |
files | src/plugins/quota/quota.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota.c Fri Dec 21 18:21:31 2007 +0200 +++ b/src/plugins/quota/quota.c Fri Dec 21 18:40:10 2007 +0200 @@ -636,8 +636,7 @@ } } -static void quota_warnings_execute(struct quota_root *root, - struct quota_transaction_context *ctx) +static void quota_warnings_execute(struct quota_root *root) { struct quota_warning_rule *warnings; unsigned int i, count; @@ -656,11 +655,9 @@ for (i = 0; i < count; i++) { if ((bytes_current < warnings[i].bytes_limit && - bytes_current + - ctx->bytes_used >= warnings[i].bytes_limit) || + bytes_current >= warnings[i].bytes_limit) || (count_current < warnings[i].count_limit && - count_current + - ctx->count_used >= warnings[i].count_limit)) { + count_current >= warnings[i].count_limit)) { quota_warning_execute(warnings[i].command); break; } @@ -682,10 +679,14 @@ ctx->recalculate) { roots = array_get(&ctx->quota->roots, &count); for (i = 0; i < count; i++) { - quota_warnings_execute(roots[i], ctx); if (roots[i]->backend.v.update(roots[i], ctx) < 0) ret = -1; } + /* execute quota warnings after all updates. this makes it + work correctly regardless of whether backend.get_resource() + returns updated values before backend.update() or not */ + for (i = 0; i < count; i++) + quota_warnings_execute(roots[i]); } i_free(ctx);