Skip to content

Have rate_limit return maximum values of rate.Inf (math.MaxFloat64) instead of "inf" #120

@chrisberkhout

Description

@chrisberkhout

This will stop any problems caused by clients not processing "inf" values. An example of the currently required processing is in qualys_vmdr.

From a discussion of this issue in a PR:

Condition the return values from the rate limit extensions so that if either of these end up being infinite, it gets replaced with rate.Inf.

I think this would be backwards compatible; the relevant text in the documentation is

The map returned by the policy functions should have "rate" and "next" fields with type rate.Limit or string with the value "inf", a "burst" field with type int and a "reset" field with type time.Time in the UTC location. The semantics of "rate" and "burst" are described in the documentation for the golang.org/x/time/rate package.

This would remain true, but the second option would never happen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions