Skip to content

New() creates a race condition if called with -race #70

@rokn

Description

@rokn

If executing multiple calls to requestid.New (in tests for example) the writing to a global var produces a race condition, this can easily be avoided with a simple lock supplementing the global var.

This kinda raised another question for me, what if I want to use the request id middleware for multiple servers in a single app with different header keys?

I honestly think it would best to save the header key in the gin context for that request and later if fetched check in the context what the key is.

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