Giter Site home page Giter Site logo

plack-middleware-throttle-lite's People

Contributors

moritz avatar wu-wu avatar

Watchers

 avatar  avatar  avatar

Forkers

moritz

plack-middleware-throttle-lite's Issues

Abstract backend bug

Hi. I found a bug in https://github.com/Wu-Wu/Plack-Middleware-Throttle-Lite/blob/master/lib/Plack/Middleware/Throttle/Lite/Backend/Abstract.pm#L73

This will always return 'req/hour' as there is no "unit" setup for each unit in $settings href in the function above.

Possible soultions are:
a) add the corresponding "unit" to each of the units hrefs in the settings, or
b) change the line in the beginning of the bug to something like:
my $unit = $self->units || 'req/hour';

This bug is kind of critical, because currently Throttle::Lite works properly only with req/hour limits for backends that rely on expires_in

Warning when running with Gazelle

When running with Gazelle (https://github.com/kazeburo/Gazelle) I get the following warning on each request:
Use of uninitialized value in join or string at /opt/plenv/versions/5.26.0/lib/perl5/site_perl/5.26.0/Plack/Middleware/Throttle/Lite.pm line 280.

This is the code in question:

# Requester's ID
sub requester_id {
    my ($self, $env) = @_;
    join ':' => 'throttle', $env->{REMOTE_ADDR}, ($env->{REMOTE_USER} || $self->defaults->{username});
}

I believe that $env->{REMOTE_ADDR} is not set by Gazelle, which may actually be a Gazelle issue.

I am running with Gazelle like this:

/opt/plenv/versions/5.26.0/bin/start_server \
    --path /run/etd.sock \
    -- \
    /opt/plenv/versions/5.26.0/bin/plackup \
    -s Gazelle \
    --max-workers 5 \
    --max-reqs-per-child 1000 \
    --min-reqs-per-child 800 \
    --app script/etd.psgi

The default HTTP::Server::PSGI server has no such warning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.