From 1b86cf7caedd848a03cdd9d641e8e8727f3b5806 Mon Sep 17 00:00:00 2001 From: Al Davidson Date: Thu, 12 Oct 2023 10:00:13 +0100 Subject: [PATCH] speed up FindByPath.find on K8s/RDS environments --- app/lib/find_by_path.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/lib/find_by_path.rb b/app/lib/find_by_path.rb index e41cb7b4..8d3a85ab 100644 --- a/app/lib/find_by_path.rb +++ b/app/lib/find_by_path.rb @@ -17,7 +17,10 @@ def find(path) return exact_match if exact_match matches = find_route_matches(path) - matches.any? ? best_route_match(matches, path) : nil + + if matches.count.positive? + best_route_match(matches, path) + end end private