Skip to content

Initialize the limit #100

Open
Open
@liuuujr

Description

@liuuujr

There are three ways to initialize a "Limit", which are "PerSecond(rate int)", "PerMinute(rate int)", "PerHour(rate int)". But the Limit generated by these three functions,the values of its "Rate" and "Burst" fields are equal。So I'd like to create a few more functions that initialize the LIMIT, which can specify the "rate" field and the "burst" field separately。

func PerHourWithCapacity(rate int, capacity int) Limit {
	return Limit{
		Rate:   rate,
		Period: time.Hour,
		Burst:  capacity,
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions