From 3764b928c5ccaaed84f5d57b74a6c27564c1c744 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 2 Jun 2017 16:36:48 -0400 Subject: [PATCH] reordered predicates, added comments --- routes/v1.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/v1.js b/routes/v1.js index fc8fe556..80c3d9b5 100644 --- a/routes/v1.js +++ b/routes/v1.js @@ -97,12 +97,14 @@ function addRoutes(app, peliasConfig) { const placeholderService = serviceWrapper(placeholderConfiguration); const isPlaceholderServiceEnabled = _.constant(placeholderConfiguration.isEnabled()); + // use coarse reverse when requested layers are all coarse const coarse_reverse_should_execute = all( - not(hasRequestErrors), isPipServiceEnabled, isCoarseReverse + isPipServiceEnabled, isCoarseReverse, not(hasRequestErrors) ); + // fallback to coarse reverse when regular reverse didn't return anything const coarse_reverse_fallback_should_execute = all( - isPipServiceEnabled, not(hasRequestErrors), not(hasResponseData), not(isCoarseReverse) + isPipServiceEnabled, not(isCoarseReverse), not(hasRequestErrors), not(hasResponseData) ); const placeholderShouldExecute = all(