prosodyctl: Fix import of util.iterators
[prosody.git] / util / throttle.lua
index 8b62e7974f3eb74ddd391ef1309b5a9de4efdbd5..2e901158096e0cc4302b2d630e8df7968186310c 100644 (file)
@@ -1,5 +1,6 @@
 
 local gettime = require "socket".gettime;
+local setmetatable = setmetatable;
 
 module "throttle"
 
@@ -33,7 +34,7 @@ function throttle:poll(cost, split)
                if split then
                        self.balance = 0;
                end
-               return false, balance, (cost-self.balance);
+               return false, balance, (cost-balance);
        end
 end