diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-11-10 22:08:16 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-11-10 22:08:16 +0100 |
commit | 415a75c25aa8efc67e4866e9e0da2bd3ff5ce0ee (patch) | |
tree | 383afada60dade1fee0b107de558ee7c720ce8a1 /src/mod_http_upload_quota.erl | |
parent | mod_http_upload: Make case indentation consistent (diff) |
mod_http_upload_quota: Don't track all users
Don't track the disk usage of accounts that have an unlimited quota.
Diffstat (limited to 'src/mod_http_upload_quota.erl')
-rw-r--r-- | src/mod_http_upload_quota.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mod_http_upload_quota.erl b/src/mod_http_upload_quota.erl index c0f138f7..d7576567 100644 --- a/src/mod_http_upload_quota.erl +++ b/src/mod_http_upload_quota.erl @@ -182,7 +182,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)]), @@ -201,7 +201,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}. |