replication/driver: automatic retries on connectivity-related errors

This commit is contained in:
Christian Schwarz
2019-03-11 13:46:36 +01:00
parent 07b43bffa4
commit c87759affe
20 changed files with 933 additions and 90 deletions

View File

@ -40,3 +40,19 @@ func Int64(varname string, def int64) int64 {
cache.Store(varname, d)
return d
}
func Bool(varname string, def bool) bool {
if v, ok := cache.Load(varname); ok {
return v.(bool)
}
e := os.Getenv(varname)
if e == "" {
return def
}
d, err := strconv.ParseBool(e)
if err != nil {
panic(err)
}
cache.Store(varname, d)
return d
}