Minor improvements

* Set minimum number of pool instances to 2
* Improve logging of sync reasons
* Improve logging of a new pool role
This commit is contained in:
Dmitrii Dolgov
2020-03-19 10:31:58 +01:00
parent 1c7065e4ce
commit 48cdbb6a65
6 changed files with 24 additions and 11 deletions
+1
View File
@@ -14,4 +14,5 @@ const (
ConnPoolContainer = 0
ConnPoolMaxDBConnections = 60
ConnPoolMaxClientConnections = 10000
ConnPoolMinInstances = 2
)
+12 -9
View File
@@ -149,22 +149,25 @@ func CoalesceInt32(val, defaultVal *int32) *int32 {
return val
}
// Test if any of the values is nil
func testNil(values ...*int32) bool {
for _, v := range values {
if v == nil {
return true
}
}
return false
}
// Return maximum of two integers provided via pointers. If one value is not
// defined, return the other one. If both are not defined, result is also
// undefined, caller needs to check for that.
func MaxInt32(a, b *int32) *int32 {
if a == nil && b == nil {
if testNil(a, b) {
return nil
}
if a == nil {
return b
}
if b == nil {
return a
}
if *a > *b {
return a
}