Skip to content

[FSSDK-9508] refact: Implements a warning log for polling interval less than 30s #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/Extensions/OptimizelyClient+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ extension OptimizelyClient {

let interval = periodicDownloadInterval ?? 10 * 60
if interval > 0 {
if interval < 30 {
logger?.w(.lowPeriodicDownloadInterval)
}
self.datafileHandler?.setPeriodicInterval(sdkKey: sdkKey, interval: interval)
}
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/Utils/LogMessage.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2019-2021, Optimizely, Inc. and contributors
// Copyright 2019-2021, 2023 Optimizely, Inc. and contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -67,6 +67,7 @@ enum LogMessage {
case failedToConvertMapToString
case failedToAssignValue
case valueForKeyNotFound(_ key: String)
case lowPeriodicDownloadInterval
}

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

return message
Expand Down