remove user account mailbox size from the control panel because it takes way too long to compute on very large mailboxes

fixes #531
This commit is contained in:
Joshua Tauberer 2018-11-30 09:33:24 -05:00
parent 7f8f4518e3
commit b05b06c74a
3 changed files with 2 additions and 11 deletions

View File

@ -146,7 +146,7 @@ def me():
@authorized_personnel_only @authorized_personnel_only
def mail_users(): def mail_users():
if request.args.get("format", "") == "json": if request.args.get("format", "") == "json":
return json_response(get_mail_users_ex(env, with_archived=True, with_slow_info=True)) return json_response(get_mail_users_ex(env, with_archived=True))
else: else:
return "".join(x+"\n" for x in get_mail_users(env)) return "".join(x+"\n" for x in get_mail_users(env))

View File

@ -105,7 +105,7 @@ def get_mail_users(env):
users = [ row[0] for row in c.fetchall() ] users = [ row[0] for row in c.fetchall() ]
return utils.sort_email_addresses(users, env) return utils.sort_email_addresses(users, env)
def get_mail_users_ex(env, with_archived=False, with_slow_info=False): def get_mail_users_ex(env, with_archived=False):
# Returns a complex data structure of all user accounts, optionally # Returns a complex data structure of all user accounts, optionally
# including archived (status="inactive") accounts. # including archived (status="inactive") accounts.
# #
@ -139,9 +139,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False):
} }
users.append(user) users.append(user)
if with_slow_info:
user["mailbox_size"] = utils.du(os.path.join(env['STORAGE_ROOT'], 'mail/mailboxes', *reversed(email.split("@"))))
# Add in archived accounts. # Add in archived accounts.
if with_archived: if with_archived:
root = os.path.join(env['STORAGE_ROOT'], 'mail/mailboxes') root = os.path.join(env['STORAGE_ROOT'], 'mail/mailboxes')
@ -158,8 +155,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False):
"mailbox": mbox, "mailbox": mbox,
} }
users.append(user) users.append(user)
if with_slow_info:
user["mailbox_size"] = utils.du(mbox)
# Group by domain. # Group by domain.
domains = { } domains = { }

View File

@ -43,7 +43,6 @@
<tr> <tr>
<th width="50%">Email Address</th> <th width="50%">Email Address</th>
<th>Actions</th> <th>Actions</th>
<th>Mailbox Size</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -73,8 +72,6 @@
archive account archive account
</a> </a>
</td> </td>
<td class='mailboxsize'>
</td>
</tr> </tr>
<tr id="user-extra-template" class="if_inactive"> <tr id="user-extra-template" class="if_inactive">
<td colspan="3" style="border: 0; padding-top: 0"> <td colspan="3" style="border: 0; padding-top: 0">
@ -156,7 +153,6 @@ function show_users() {
n.attr('data-email', user.email); n.attr('data-email', user.email);
n.find('.address').text(user.email) n.find('.address').text(user.email)
n.find('.mailboxsize').text(nice_size(user.mailbox_size))
n2.find('.restore_info tt').text(user.mailbox); n2.find('.restore_info tt').text(user.mailbox);
if (user.status == 'inactive') continue; if (user.status == 'inactive') continue;