mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? - Split implementation of "constrained default" settings from "plain default" settings. This is more code and the diff looks complex, but the individual paths are both simpler than the mixed version. - Add conversion cache using a weak map. - Remove GlobalCachedTypedValue. - Use "raw" values for subscription dispatch deduping to avoid unnecessary conversions. - Deep copy default values when using mapstructure, to avoid problems with merging over shared default values. ## Why? - Fixes #6756 - Performance improvement for "plain default" settings (almost all of them) - Performance improvement for settings with complex converters - Remove footgun in defaults that aren't scalar values ## How did you test it? existing+new unit tests
24 lines
524 B
Go
24 lines
524 B
Go
package dynamicconfig
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/mitchellh/mapstructure"
|
|
"go.temporal.io/server/common/util"
|
|
)
|
|
|
|
var (
|
|
MatchAnythingRE = regexp.MustCompile(".*")
|
|
MatchNothingRE = regexp.MustCompile(".^")
|
|
)
|
|
|
|
func ConvertWildcardStringListToRegexp(in any) (*regexp.Regexp, error) {
|
|
// first convert raw value to list of strings
|
|
var patterns []string
|
|
if err := mapstructure.Decode(in, &patterns); err != nil {
|
|
return nil, err
|
|
}
|
|
// then turn strings into regexp
|
|
return util.WildCardStringsToRegexp(patterns)
|
|
}
|