aboutsummaryrefslogtreecommitdiffstats
path: root/util/throttle.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
committerKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
commit6ef7c4d80892f486d71e660b054bdfdb993c8528 (patch)
tree103fd7d9396b60b9f76071a009c54d3ca9d35744 /util/throttle.lua
parenta9029bd099734436154fc4e794d3b958e54d1943 (diff)
parentd32f36b2817739d7f8d5f1208a3009b7be379562 (diff)
downloadprosody-6ef7c4d80892f486d71e660b054bdfdb993c8528.tar.gz
prosody-6ef7c4d80892f486d71e660b054bdfdb993c8528.zip
Merge 0.10->trunk
Diffstat (limited to 'util/throttle.lua')
-rw-r--r--util/throttle.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/util/throttle.lua b/util/throttle.lua
index 55e1d07b..3d3f5d2d 100644
--- a/util/throttle.lua
+++ b/util/throttle.lua
@@ -3,7 +3,7 @@ local gettime = require "socket".gettime;
local setmetatable = setmetatable;
local floor = math.floor;
-module "throttle"
+local _ENV = nil;
local throttle = {};
local throttle_mt = { __index = throttle };
@@ -39,8 +39,10 @@ function throttle:poll(cost, split)
end
end
-function create(max, period)
+local function create(max, period)
return setmetatable({ rate = max / period, max = max, t = 0, balance = max }, throttle_mt);
end
-return _M;
+return {
+ create = create;
+};