Skip to content

The "slack" option doesn't make effect when use newAtomicInt64Based version rate limit #122

@nemohan

Description

@nemohan

Use following test code:
func TestSlack2(t *testing.T) { rl := New(1, WithSlack(2)) // per second, some slack. rl.Take() // Initialize. time.Sleep(time.Second * 4) for i := 0; i < 100; i++ { rl.Take() fmt.Printf("%d\n", time.Now().Unix()) } }
I got those output:
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
1702546953
....

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