Skip to content

Commit a8f3674

Browse files
committed
Add FF to turn *off* Indexing Service for debugging
1 parent c3e9ce0 commit a8f3674

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/middleware/withLocator.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,17 @@ function isIndexingServiceEnabled (request, env) {
6262
const withIndexingServicesArg = new URL(request.url).searchParams
6363
.getAll('ff')
6464
.includes('indexing-service')
65-
const probability = env.FF_RAMP_UP_PROBABILITY ? Number(env.FF_RAMP_UP_PROBABILITY) : 0
66-
const withIndexerEnabled = Math.random() * 100 <= probability
67-
return withIndexingServicesArg || withIndexerEnabled
65+
const withoutIndexingServicesArg = new URL(request.url).searchParams
66+
.getAll('ff')
67+
.includes('no-indexing-service')
68+
const probability = env.FF_RAMP_UP_PROBABILITY
69+
? Number(env.FF_RAMP_UP_PROBABILITY)
70+
: 0
71+
const withIndexerEnabledProbabalistically = Math.random() * 100 <= probability
72+
return (
73+
// We haven't explicitly disabled the indexing service, and
74+
!withoutIndexingServicesArg &&
75+
// We have explicitly enabled the indexing service, or hit it probabilistically.
76+
(withIndexingServicesArg || withIndexerEnabledProbabalistically)
77+
)
6878
}

0 commit comments

Comments
 (0)