Skip to content

Order of rate checks in InMemoryBucket seems odd. #239

@pafi-code

Description

@pafi-code

Problem Description

In your InMemoryBucket you seem to sort the rates in the wrong order, no?

self.rates = sorted(rates, key=lambda r: r.interval)

This means when I configure that I have a rates

[pyrate_limiter.Rate(3, pyrate_limiter.Duration.MINUTE), pyrate_limiter.Rate(1, pyrate_limiter.Duration.DAY)]

then always the minutes are checked first. So shouldn't the order when you sort the list of rates be reversed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions