mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:09:05 +00:00
Disable multithreaded scanners for sqlite
as it's not reliable
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
db_drivers "github.com/photoview/photoview/api/database/drivers"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -22,10 +23,16 @@ func GetSiteInfo(db *gorm.DB) (*SiteInfo, error) {
|
||||
|
||||
if err := db.First(&siteInfo).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
|
||||
defaultConcurrentWorkers := 3
|
||||
if db_drivers.DatabaseDriver() == db_drivers.DatabaseDriverSqlite {
|
||||
defaultConcurrentWorkers = 1
|
||||
}
|
||||
|
||||
siteInfo = SiteInfo{
|
||||
InitialSetup: true,
|
||||
PeriodicScanInterval: 0,
|
||||
ConcurrentWorkers: 3,
|
||||
ConcurrentWorkers: defaultConcurrentWorkers,
|
||||
}
|
||||
|
||||
if err := db.Create(&siteInfo).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user