Files
mostlymatter/vendor/github.com/splitio/go-split-commons/v2/util/mode.go
Christopher Speller 1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* 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>
2020-10-29 15:54:39 -07:00

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
}