Skip to content

Commit 17b98dd

Browse files
committed
Move signals parsing outside try...except block
1 parent 7e7786b commit 17b98dd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/server/_limiter.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ def check_signals_allowlist(request):
7575
request_signals = set()
7676
try:
7777
source_signal_sets = parse_source_signal_sets()
78-
for source_signal in source_signal_sets:
79-
# source_signal.signal is expected to be eiter list or bool:
80-
# in case of bool, we have wildcard signal -> return False as there are no chances that
81-
# all signals from given source will be whitelisted
82-
# in case of list, we have list of signals
83-
if isinstance(source_signal.signal, bool):
84-
return False
85-
for signal in source_signal.signal:
86-
request_signals.add(f"{source_signal.source}:{signal}")
8778
except ValidationFailedException:
8879
return False
80+
for source_signal in source_signal_sets:
81+
# source_signal.signal is expected to be eiter list or bool:
82+
# in case of bool, we have wildcard signal -> return False as there are no chances that
83+
# all signals from given source will be whitelisted
84+
# in case of list, we have list of signals
85+
if isinstance(source_signal.signal, bool):
86+
return False
87+
for signal in source_signal.signal:
88+
request_signals.add(f"{source_signal.source}:{signal}")
8989
if len(request_signals) == 0:
9090
return False
9191
return request_signals.issubset(signals_allowlist)

0 commit comments

Comments
 (0)