Skip to content

Commit 51d33b6

Browse files
authored
[FSSDK-9508] refact: Implements a warning log for polling interval less than 30s (#515)
* Implements a warning log for polling interval less than 30s
1 parent 236d76d commit 51d33b6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Sources/Extensions/OptimizelyClient+Extension.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ extension OptimizelyClient {
8181

8282
let interval = periodicDownloadInterval ?? 10 * 60
8383
if interval > 0 {
84+
if interval < 30 {
85+
logger?.w(.lowPeriodicDownloadInterval)
86+
}
8487
self.datafileHandler?.setPeriodicInterval(sdkKey: sdkKey, interval: interval)
8588
}
8689
}

Sources/Utils/LogMessage.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2019-2021, Optimizely, Inc. and contributors
2+
// Copyright 2019-2021, 2023 Optimizely, Inc. and contributors
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -67,6 +67,7 @@ enum LogMessage {
6767
case failedToConvertMapToString
6868
case failedToAssignValue
6969
case valueForKeyNotFound(_ key: String)
70+
case lowPeriodicDownloadInterval
7071
}
7172

7273
extension LogMessage: CustomStringConvertible {
@@ -128,6 +129,7 @@ extension LogMessage: CustomStringConvertible {
128129
case .failedToConvertMapToString: message = "Provided map could not be converted to string."
129130
case .failedToAssignValue: message = "Value for path could not be assigned to provided type."
130131
case .valueForKeyNotFound(let key): message = "Value for JSON key (\(key)) not found."
132+
case .lowPeriodicDownloadInterval: message = "Polling intervals below 30 seconds are not recommended."
131133
}
132134

133135
return message

0 commit comments

Comments
 (0)