3333
3434// public class SettingsManager implements ISettingsManager {
3535public class SettingsManager {
36- private String sdkKey ;
37- private Integer accountId ;
36+ public String sdkKey ;
37+ public Integer accountId ;
3838 private int expiry ;
3939 private int networkTimeout ;
4040 public String hostname ;
4141 public int port ;
4242 public String protocol = "https" ;
4343 public boolean isGatewayServiceProvided = false ;
44+ public boolean isSettingsValidOnInit = false ;
45+ private Long settingsFetchTime ;
4446 private static SettingsManager instance ;
4547
4648 public SettingsManager (VWOInitOptions options ) {
@@ -85,6 +87,14 @@ public static SettingsManager getInstance() {
8587 return instance ;
8688 }
8789
90+ /**
91+ * Gets the settings fetch time
92+ * @return The settings fetch time in milliseconds
93+ */
94+ public Long getSettingsFetchTime () {
95+ return this .settingsFetchTime ;
96+ }
97+
8898 /**
8999 * Fetches settings from the server
90100 */
@@ -126,6 +136,9 @@ public String fetchSettings(Boolean isViaWebhook) {
126136 }
127137
128138 try {
139+ // Set fetch time
140+ long startTime = System .currentTimeMillis ();
141+
129142 RequestModel request = new RequestModel (hostname , "GET" , endpoint , options , null , null , this .protocol , port );
130143 request .setTimeout (networkTimeout );
131144
@@ -138,6 +151,7 @@ public String fetchSettings(Boolean isViaWebhook) {
138151 });
139152 return null ;
140153 }
154+ this .settingsFetchTime = System .currentTimeMillis () - startTime ;
141155 return response .getData ();
142156 } catch (Exception e ) {
143157 LoggerService .log (LogLevelEnum .ERROR , "SETTINGS_FETCH_ERROR" , new HashMap <String , String >() {
@@ -166,6 +180,7 @@ public String getSettings(Boolean forceFetch) {
166180 }
167181 boolean settingsValid = new SettingsSchema ().isSettingsValid (VWOClient .objectMapper .readValue (settings , Settings .class ));
168182 if (settingsValid ) {
183+ this .isSettingsValidOnInit = true ;
169184 return settings ;
170185 } else {
171186 LoggerService .log (LogLevelEnum .ERROR , "SETTINGS_SCHEMA_INVALID" , null );
0 commit comments