Skip to content

set/parse race conditions #53

@carlofaessler

Description

@carlofaessler

It would be better if the IP and UA could be passed directly to the parse() method rather than having to use set() before.

let ret = udgerParser.parse({
    ua:'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
    ip:'2A02:598:7000:116:0:0:0:101'
});

The parser should be stateless to avoid problems in race conditions. For example it could happen that two requests to our service which accesses the global Udger instance from inside an async function happen at the same time, leading to a set() -> set() -> parse() -> parse() sequence where the second request overwrites the IP and UA of the first request before the first request gets to the parse() method call

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