Don't take lock for read/GET operations : also cover cases when there's a list of routes

This commit is contained in:
Alexandre Aubin 2022-12-24 00:57:17 +01:00
parent ac0ac24996
commit 1e79e99cc8

View file

@ -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