File tree 2 files changed +4
-6
lines changed
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,7 @@ const conf = {
37
37
} ,
38
38
timeout : process . env . WTP_TIMEOUT || 30000 ,
39
39
"locationSelector" : {
40
- "enabled" : process . env . WTP_LS_ENABLED || false ,
41
- "allowedLocationsRegex" : process . env . WTP_LS_ALLOWED_LOCATIONS_REGEX || '_US_' ,
40
+ "allowRegex" : process . env . WTP_LS_ALLOW_REGEX || '_US_' ,
42
41
"cacheTtl" : process . env . WTP_LS_CACHE_TTL || 10 ,
43
42
"updateTimeout" : process . env . WTP_LS_UPDATE_TIMEOUT || 20 ,
44
43
"defaultLocation" : process . env . WTP_LS_DEFAULT_LOCATION || "IAD_US_01"
Original file line number Diff line number Diff line change @@ -29,10 +29,9 @@ const locationMetrics = {
29
29
class LocationSelector {
30
30
constructor ( ) {
31
31
if ( ! LocationSelector . instance ) {
32
- this . enabled = config . get ( 'wtp.locationSelector.enabled' ) ;
33
32
this . cachedAllLocations = [ ] ;
34
33
this . location = config . get ( 'wtp.locationSelector.defaultLocation' ) ;
35
- this . allowedLocationsRegex = new RegExp ( config . get ( 'wtp.locationSelector.allowedLocationsRegex ' ) ) ;
34
+ this . allowRegex = new RegExp ( config . get ( 'wtp.locationSelector.allowRegex ' ) ) ;
36
35
this . lastUpdated = null ;
37
36
this . mutex = withTimeout ( new Mutex ( ) , config . get ( 'wtp.locationSelector.updateTimeout' ) * 1000 ) ;
38
37
LocationSelector . instance = this ;
@@ -115,7 +114,7 @@ class LocationSelector {
115
114
}
116
115
117
116
const filtered = Object . keys ( newLocations )
118
- . filter ( key => this . allowedLocationsRegex . test ( key ) )
117
+ . filter ( key => this . allowRegex . test ( key ) )
119
118
. reduce ( ( arr , key ) => {
120
119
return [ ...arr , newLocations [ key ] ] ;
121
120
} , [ ] ) ;
@@ -155,7 +154,7 @@ class LocationSelector {
155
154
} ;
156
155
157
156
async getLocation ( ) {
158
- if ( this . enabled && this . isExpired ( ) ) {
157
+ if ( this . isExpired ( ) ) {
159
158
try {
160
159
await this . mutex . runExclusive ( async ( ) => {
161
160
if ( this . isExpired ( ) ) {
You can’t perform that action at this time.
0 commit comments