From 7f0447514c580e8cff42ce15f3dbe54938f6b6b7 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sat, 21 Apr 2018 17:19:44 +0200 Subject: [PATCH] Finish storing the user quota to redis --- core/admin/mailu/models.py | 2 +- core/dovecot/conf/dovecot.conf | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index cac1728d..e08602d2 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -260,7 +260,7 @@ class User(Base, Email): @property def quota_bytes_used(self): - return quota.get(self.email) or 0 + return quota.get(self.email + "/quota/storage") or 0 scheme_dict = {'SHA512-CRYPT': "sha512_crypt", 'SHA256-CRYPT': "sha256_crypt", diff --git a/core/dovecot/conf/dovecot.conf b/core/dovecot/conf/dovecot.conf index 31271750..ca47aaec 100644 --- a/core/dovecot/conf/dovecot.conf +++ b/core/dovecot/conf/dovecot.conf @@ -5,7 +5,6 @@ log_path = /dev/stderr protocols = imap pop3 lmtp sieve postmaster_address = {{ POSTMASTER }}@{{ DOMAIN }} hostname = {{ HOSTNAMES.split(",")[0] }} -mail_plugins = $mail_plugins quota quota_clone submission_host = front service dict { @@ -31,6 +30,9 @@ mail_gid = mail mail_privileged_group = mail mail_access_groups = mail maildir_stat_dirs = yes +mailbox_list_index = yes +mail_vsize_bg_after_count = 100 +mail_plugins = $mail_plugins quota quota_clone namespace inbox { inbox = yes @@ -52,6 +54,12 @@ namespace inbox { } } +plugin { + quota = count:User quota + quota_vsizes = yes + quota_clone_dict = redis:host={{ REDIS_ADDRESS }}:port=6379:db=1 +} + ############### # Authentication ############### @@ -117,11 +125,6 @@ service lmtp { } } -plugin { - quota = maildir:User quota - quota_clone_dict = redis:host={{ REDIS_ADDRESS }}:db=1 -} - ############### # Filtering