5 function lua_async.limiting.unset_limit(co)
6 lua_async.limiting.pool[co] = nil
9 function lua_async.set_limit(ms)
10 local co = assert(coroutine.running(), "set_limit called outside of an async function")
12 local limit = ms / 1000
14 lua_async.limiting.pool[co] = {
16 next_yield = lua_async.clock() + limit,
20 function lua_async.unset_limit()
21 local co = assert(coroutine.running(), "unset_limit called outside of an async function")
22 lua_async.limiting.unset_limit(co)
25 function lua_async.check_limit()
26 local co = assert(coroutine.running(), "check_limit called outside of an async function")
27 local limit = lua_async.limiting.pool[co]
29 if limit and lua_async.clock() >= limit.next_yield then
31 limit.next_yield = lua_async.clock() + limit.limit