diff options
author | Tim Burke <tim.burke@gmail.com> | 2023-05-05 12:26:54 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2023-05-05 12:27:01 -0700 |
commit | 9d98721e7c94677ed06224b8f8c8c69e26793fec (patch) | |
tree | 66d639abbddbd518cd83d685a69b4d8fafeb019e | |
parent | f99a6e5762896c7789d168bc49d8cdcb47903264 (diff) | |
download | swift-9d98721e7c94677ed06224b8f8c8c69e26793fec.tar.gz |
backend_ratelimit: Tighten blanket exception handling
As it was, it would hide issues in the logging or ratelimiter
implementations.
Change-Id: I9e557442401ef17b753f45b9e1cb181e71784ccf
-rw-r--r-- | swift/common/middleware/backend_ratelimit.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/swift/common/middleware/backend_ratelimit.py b/swift/common/middleware/backend_ratelimit.py index 980e9edc4..75e6e9741 100644 --- a/swift/common/middleware/backend_ratelimit.py +++ b/swift/common/middleware/backend_ratelimit.py @@ -66,13 +66,14 @@ class BackendRateLimitMiddleware(object): try: device, partition, _ = split_and_validate_path(req, 1, 3, True) int(partition) # check it's a valid partition + except Exception: # noqa + # request may not have device/partition e.g. a healthcheck req + pass + else: rate_limiter = self.rate_limiters[device] if not rate_limiter.is_allowed(): self.logger.increment('backend.ratelimit') handler = HTTPTooManyBackendRequests() - except Exception: # noqa - # request may not have device/partition e.g. a healthcheck req - pass return handler(env, start_response) |