diff options
Diffstat (limited to 'limiting.lua')
-rw-r--r-- | limiting.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/limiting.lua b/limiting.lua index d5df448..394006d 100644 --- a/limiting.lua +++ b/limiting.lua @@ -13,7 +13,7 @@ function lua_async.set_limit(ms) lua_async.limiting.pool[co] = { limit = limit, - next_yield = os.clock() + limit, + next_yield = lua_async.clock() + limit, } end @@ -26,9 +26,9 @@ function lua_async.check_limit() local co = assert(coroutine.running(), "check_limit called outside of an async function") local limit = lua_async.limiting.pool[co] - if limit and os.clock() >= limit.next_yield then + if limit and lua_async.clock() >= limit.next_yield then lua_async.yield() - limit.next_yield = os.clock() + limit.limit + limit.next_yield = lua_async.clock() + limit.limit return true end |