projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 0.10->trunk
[prosody.git]
/
util
/
throttle.lua
diff --git
a/util/throttle.lua
b/util/throttle.lua
index 55e1d07b3f5a836b450fc65cf23a1c31b7363e49..3d3f5d2d8b029f9134de0276620411b06390abac 100644
(file)
--- a/
util/throttle.lua
+++ b/
util/throttle.lua
@@
-3,7
+3,7
@@
local gettime = require "socket".gettime;
local setmetatable = setmetatable;
local floor = math.floor;
local setmetatable = setmetatable;
local floor = math.floor;
-module "throttle"
+local _ENV = nil;
local throttle = {};
local throttle_mt = { __index = throttle };
local throttle = {};
local throttle_mt = { __index = throttle };
@@
-39,8
+39,10
@@
function throttle:poll(cost, split)
end
end
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 setmetatable({ rate = max / period, max = max, t = 0, balance = max }, throttle_mt);
end
-return _M;
+return {
+ create = create;
+};