mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +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 {
|
||||
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")
|
||||
}
|
||||
|
||||
@ -25,15 +25,19 @@ func NewConnectionInfo(openConns, idleConns uint32, pusherRatio float64) (*Conne
|
||||
info.EventstorePusher.MaxOpenConns = uint32(pusherRatio * float64(openConns))
|
||||
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
|
||||
}
|
||||
if info.EventstorePusher.MaxIdleConns < 1 && pusherRatio > 0 {
|
||||
if idleConns != 0 && info.EventstorePusher.MaxIdleConns < 1 && pusherRatio > 0 {
|
||||
info.EventstorePusher.MaxIdleConns = 1
|
||||
}
|
||||
|
||||
info.ZITADEL.MaxOpenConns = openConns - info.EventstorePusher.MaxOpenConns
|
||||
info.ZITADEL.MaxIdleConns = idleConns - info.EventstorePusher.MaxIdleConns
|
||||
if openConns != 0 {
|
||||
info.ZITADEL.MaxOpenConns = openConns - info.EventstorePusher.MaxOpenConns
|
||||
}
|
||||
if idleConns != 0 {
|
||||
info.ZITADEL.MaxIdleConns = idleConns - info.EventstorePusher.MaxIdleConns
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user