Skip to content

Chapter 9: Testing TokenBucketv2 #7

@mshearer0

Description

@mshearer0

In testing TokenBucketv2 by sending curl requests from a single machine i found using r.remoteAddr as UID gave a different value everytime as a new port was assigned for each http request. The throttle therefore was not envoked.

To test i truncated r.remote Addr to just IP by removing port:

import strings

replacing r.remoteAddr in the call to throttled with strings.Split(r.RemoteAddr, ":")[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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