rate_limit_legacy function

Legacy rate limiting function