mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-03-16 21:07:30 +01:00
Add busyTimeout config setting
Entire-Checkpoint: 81097a6c52a2
This commit is contained in:
@@ -148,7 +148,8 @@ usage can be tuned via the optional `db-config` section in config.json under
|
|||||||
"soft-heap-limit-mb": 16384,
|
"soft-heap-limit-mb": 16384,
|
||||||
"max-open-connections": 4,
|
"max-open-connections": 4,
|
||||||
"max-idle-connections": 4,
|
"max-idle-connections": 4,
|
||||||
"max-idle-time-minutes": 10
|
"max-idle-time-minutes": 10,
|
||||||
|
"busy-timeout-ms": 60000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,6 +167,7 @@ are used.
|
|||||||
| `max-open-connections` | 4 | Maximum number of open database connections. |
|
| `max-open-connections` | 4 | Maximum number of open database connections. |
|
||||||
| `max-idle-connections` | 4 | Maximum number of idle database connections kept in the pool. |
|
| `max-idle-connections` | 4 | Maximum number of idle database connections kept in the pool. |
|
||||||
| `max-idle-time-minutes` | 10 | Maximum time in minutes a connection can sit idle before being closed. |
|
| `max-idle-time-minutes` | 10 | Maximum time in minutes a connection can sit idle before being closed. |
|
||||||
|
| `busy-timeout-ms` | 60000 | SQLite busy timeout in milliseconds. When a write is blocked by another writer, SQLite retries internally with backoff for up to this duration before returning `SQLITE_BUSY`. |
|
||||||
|
|
||||||
### Sizing Guidelines
|
### Sizing Guidelines
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ func initDatabase() error {
|
|||||||
if dc.ConnectionMaxIdleTimeMins > 0 {
|
if dc.ConnectionMaxIdleTimeMins > 0 {
|
||||||
cfg.ConnectionMaxIdleTime = time.Duration(dc.ConnectionMaxIdleTimeMins) * time.Minute
|
cfg.ConnectionMaxIdleTime = time.Duration(dc.ConnectionMaxIdleTimeMins) * time.Minute
|
||||||
}
|
}
|
||||||
|
if dc.BusyTimeoutMs > 0 {
|
||||||
|
cfg.BusyTimeoutMs = dc.BusyTimeoutMs
|
||||||
|
}
|
||||||
repository.SetConfig(cfg)
|
repository.SetConfig(cfg)
|
||||||
}
|
}
|
||||||
repository.Connect(config.Keys.DB)
|
repository.Connect(config.Keys.DB)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ type DbConfig struct {
|
|||||||
MaxOpenConnections int `json:"max-open-connections"`
|
MaxOpenConnections int `json:"max-open-connections"`
|
||||||
MaxIdleConnections int `json:"max-idle-connections"`
|
MaxIdleConnections int `json:"max-idle-connections"`
|
||||||
ConnectionMaxIdleTimeMins int `json:"max-idle-time-minutes"`
|
ConnectionMaxIdleTimeMins int `json:"max-idle-time-minutes"`
|
||||||
|
BusyTimeoutMs int `json:"busy-timeout-ms"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeStateRetention struct {
|
type NodeStateRetention struct {
|
||||||
|
|||||||
@@ -201,6 +201,10 @@ var configSchema = `
|
|||||||
"max-idle-time-minutes": {
|
"max-idle-time-minutes": {
|
||||||
"description": "Maximum idle time for a connection in minutes (default: 10).",
|
"description": "Maximum idle time for a connection in minutes (default: 10).",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"busy-timeout-ms": {
|
||||||
|
"description": "SQLite busy timeout in milliseconds. When a write is blocked, SQLite retries with backoff for up to this duration before returning SQLITE_BUSY (default: 60000).",
|
||||||
|
"type": "integer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user