| blib/lib/PAGI/Middleware/RateLimit.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| condition | 16 | 22 | 72.7 |
| line | l | !l | condition |
|---|---|---|---|
| 75 | 8 | 0 | $config->{'requests_per_second'} // 10 |
| 76 | 8 | 0 | $config->{'burst'} // 20 |
| 79 | 38 | 0 | $scope->{'client'}[0] // "unknown" |
| 81 | 0 | 8 | $config->{'backend'} // "memory" |
| 82 | 3 | 5 | $config->{'cleanup_interval'} // 60 |
| 83 | 1 | 7 | $config->{'max_buckets'} // 10000 |
| 108 | 37 | 0 | $event->{'headers'} // [] |
| 133 | 15 | 26 | $buckets{$key} //= {"tokens", $burst, "last_time", $now} |
| line | l | !l&&r | !l&&!r | condition |
|---|---|---|---|---|
| 80 | 1 | 7 | 0 | $config->{'key_generator'} // sub { my($scope) = @_; return exists $scope->{'client'} ? $scope->{'client'}[0] // "unknown" : "unknown"; } |
| 159 | 8 | 2 | 31 | not $self->{'_last_cleanup'} or $now - $self->{'_last_cleanup'} >= $self->{'cleanup_interval'} |