]> granicus.if.org Git - ejabberd/commitdiff
mod_http_upload_quota: Don't track all users
authorHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 10 Nov 2015 21:08:16 +0000 (22:08 +0100)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 10 Nov 2015 21:08:16 +0000 (22:08 +0100)
Don't track the disk usage of accounts that have an unlimited quota.

src/mod_http_upload_quota.erl

index c0f138f763fd3d462a7c2aefdb3c189f278523a1..d7576567e5930daff3ff38c0e60fbc13813373f1 100644 (file)
@@ -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}.