Skip to content

Support rate limiting globally by job, rather than globally by queue #11

Description

@TkTech

We may be able to generalize the rate limiting to make it suitable for both use cases, albeit with more setup. Something like:

queue = Queue("default", rate_limit_key="amazon_api_requests")
job = Job(...).with_rate_limit_key("amazon_api_requests")
job = Job(...).with_rate_limit_key("amazon_api_requests").with_rate_limit_partition("customer_id")

Would cause both that job and that queue to share the same global rate limit, with the 3rd job having a rate limit per distinct customer_id.

You'd then initialize/reset/adjust a global rate limit with:

await chancy.push_rate_limit("amazon_api_requests", 30, 60)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions