* Add feature flag managment system using split.io and remove viper. * Fixing tests. * Attempt to fix postgres tests. * Fix watch filepath for advanced logging. * Review fixes. * Some error wrapping. * Remove unessisary store interface. * Desanitize SplitKey * Simplify. * Review feedback. * Rename split mlog adatper to split logger. * fsInner * Style. * Restore oldcfg test. * Downgrading non-actionable feature flag errors to warnings. Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
31 строка
747 B
Go
31 строка
747 B
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/splitio/go-split-commons/v2/conf"
|
|
)
|
|
|
|
// ShouldAddPreviousTime returns if previous time should be set up or not depending on operationMode
|
|
func ShouldAddPreviousTime(managerConfig conf.ManagerConfig) bool {
|
|
switch strings.ToLower(managerConfig.OperationMode) {
|
|
case conf.ProducerSync:
|
|
fallthrough
|
|
case conf.Standalone:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// ShouldBeOptimized returns if should dedupe impressions or not depending on configs
|
|
func ShouldBeOptimized(managerConfig conf.ManagerConfig) bool {
|
|
if !ShouldAddPreviousTime(managerConfig) {
|
|
return false
|
|
}
|
|
if strings.ToLower(managerConfig.ImpressionsMode) == conf.ImpressionsModeOptimized {
|
|
return true
|
|
}
|
|
return false
|
|
}
|