From b6f52732286bfd8f4779bfec3fe9f3ccabdeaeed Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Tue, 10 Nov 2015 22:08:16 +0100 Subject: [PATCH] mod_http_upload_quota: Don't track all users Don't track the disk usage of accounts that have an unlimited quota. --- mod_http_upload/src/mod_http_upload_quota.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mod_http_upload/src/mod_http_upload_quota.erl b/mod_http_upload/src/mod_http_upload_quota.erl index 8b78dec..a232e30 100644 --- a/mod_http_upload/src/mod_http_upload_quota.erl +++ b/mod_http_upload/src/mod_http_upload_quota.erl @@ -164,7 +164,7 @@ handle_cast({handle_slot_request, #jid{user = U, server = S} = JID, Path, Size}, {0, 0} -> ?DEBUG("No quota specified for ~s", [jlib:jid_to_string(JID)]), - Size; + undefined; {0, _} -> ?WARNING_MSG("No hard quota specified for ~s", [jlib:jid_to_string(JID)]), @@ -183,7 +183,12 @@ handle_cast({handle_slot_request, #jid{user = U, server = S} = JID, Path, Size}, [jlib:jid_to_string(JID)]), enforce_quota(Path, Size, OldSize, SoftQuota, HardQuota) end, - {noreply, State#state{disk_usage = dict:store({U, S}, NewSize, DiskUsage)}}; + NewDiskUsage = if is_integer(NewSize) -> + dict:store({U, S}, NewSize, DiskUsage); + true -> + DiskUsage + end, + {noreply, State#state{disk_usage = NewDiskUsage}}; handle_cast(Request, State) -> ?ERROR_MSG("Got unexpected request: ~p", [Request]), {noreply, State}.