Limit number of default workers when using SQLite #558
Signed-off-by: Michael Mayer <michael@lastzero.net>
This commit is contained in:
parent
458dfcefdc
commit
28ec2df70f
1 changed files with 5 additions and 0 deletions
|
@ -232,6 +232,11 @@ func (c *Config) Shutdown() {
|
|||
func (c *Config) Workers() int {
|
||||
numCPU := runtime.NumCPU()
|
||||
|
||||
// Limit number of workers when using SQLite to avoid database locking issues.
|
||||
if c.DatabaseDriver() == SQLite && numCPU > 8 && c.params.Workers <= 0 {
|
||||
return 8
|
||||
}
|
||||
|
||||
if c.params.Workers > 0 && c.params.Workers <= numCPU {
|
||||
return c.params.Workers
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue