mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-02 17:51:44 +00:00
fix(db): allow unlimited connections (#6758)
This commit is contained in:
parent
3a01558c61
commit
4d4f649eda
@ -16,7 +16,7 @@ func NewConnectionInfo(openConns, idleConns uint32, pusherRatio float64) (*Conne
|
|||||||
if pusherRatio < 0 || pusherRatio > 1 {
|
if pusherRatio < 0 || pusherRatio > 1 {
|
||||||
return nil, errors.New("EventPushConnRatio must be between 0 and 1")
|
return nil, errors.New("EventPushConnRatio must be between 0 and 1")
|
||||||
}
|
}
|
||||||
if openConns < 2 {
|
if openConns != 0 && openConns < 2 {
|
||||||
return nil, errors.New("MaxOpenConns of the database must be higher that 1")
|
return nil, errors.New("MaxOpenConns of the database must be higher that 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,15 +25,19 @@ func NewConnectionInfo(openConns, idleConns uint32, pusherRatio float64) (*Conne
|
|||||||
info.EventstorePusher.MaxOpenConns = uint32(pusherRatio * float64(openConns))
|
info.EventstorePusher.MaxOpenConns = uint32(pusherRatio * float64(openConns))
|
||||||
info.EventstorePusher.MaxIdleConns = uint32(pusherRatio * float64(idleConns))
|
info.EventstorePusher.MaxIdleConns = uint32(pusherRatio * float64(idleConns))
|
||||||
|
|
||||||
if info.EventstorePusher.MaxOpenConns < 1 && pusherRatio > 0 {
|
if openConns != 0 && info.EventstorePusher.MaxOpenConns < 1 && pusherRatio > 0 {
|
||||||
info.EventstorePusher.MaxOpenConns = 1
|
info.EventstorePusher.MaxOpenConns = 1
|
||||||
}
|
}
|
||||||
if info.EventstorePusher.MaxIdleConns < 1 && pusherRatio > 0 {
|
if idleConns != 0 && info.EventstorePusher.MaxIdleConns < 1 && pusherRatio > 0 {
|
||||||
info.EventstorePusher.MaxIdleConns = 1
|
info.EventstorePusher.MaxIdleConns = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
info.ZITADEL.MaxOpenConns = openConns - info.EventstorePusher.MaxOpenConns
|
if openConns != 0 {
|
||||||
info.ZITADEL.MaxIdleConns = idleConns - info.EventstorePusher.MaxIdleConns
|
info.ZITADEL.MaxOpenConns = openConns - info.EventstorePusher.MaxOpenConns
|
||||||
|
}
|
||||||
|
if idleConns != 0 {
|
||||||
|
info.ZITADEL.MaxIdleConns = idleConns - info.EventstorePusher.MaxIdleConns
|
||||||
|
}
|
||||||
|
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user