5.2.9. vlcp.event.ratelimiter


This document is generated from the source file.

View Source on GitHub

Created on 2018/4/19

Preventing many time-consuming operations to be done in the same loop

class vlcp.event.ratelimiter.RateLimiter(limit, container)

Limit operations executed in current loop, ensure sockets are still processed in time-consuming operations

__init__(limit, container)
  • limit – “resources” limited in a single loop. “resources” can be any countable things like operations executed or bytes sent
  • container – a RoutineContainer

Acquire “resources”, wait until enough “resources” are acquired. For each loop, limit number of “resources” are permitted.

Parameters:use – number of “resouces” to be used.
Returns:True if is limited
class vlcp.event.ratelimiter.RateLimitingEvent(*args, **kwargs)