Common fn for rate limiting