From 1e79e99cc868d73efd823db06b02e7f7dfe9fa2f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 24 Dec 2022 00:57:17 +0100 Subject: [PATCH] Don't take lock for read/GET operations : also cover cases when there's a list of routes --- moulinette/actionsmap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moulinette/actionsmap.py b/moulinette/actionsmap.py index c9da16b5..7e51deb0 100644 --- a/moulinette/actionsmap.py +++ b/moulinette/actionsmap.py @@ -666,7 +666,8 @@ class ActionsMap: # Disable the locking mechanism for all actions that are 'GET' actions on the api routes = action_options.get("api") - if routes and isinstance(routes, str) and routes.startswith("GET "): + routes = [routes] if isinstance(routes, str) else routes + if routes and all(route.startswith("GET ") for route in routes): action_parser.want_to_take_lock = False else: action_parser.want_to_take_lock = True @@ -716,7 +717,8 @@ class ActionsMap: # Disable the locking mechanism for all actions that are 'GET' actions on the api routes = action_options.get("api") - if routes and isinstance(routes, str) and routes.startswith("GET "): + routes = [routes] if isinstance(routes, str) else routes + if routes and all(route.startswith("GET ") for route in routes): action_parser.want_to_take_lock = False else: action_parser.want_to_take_lock = True