mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 18:29:17 +00:00
Disable multithreaded scanners for sqlite
as it's not reliable
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/photoview/photoview/api/database/drivers"
|
||||
"github.com/photoview/photoview/api/graphql/models"
|
||||
"github.com/photoview/photoview/api/scanner"
|
||||
"github.com/pkg/errors"
|
||||
@@ -66,6 +67,10 @@ func (r *mutationResolver) SetScannerConcurrentWorkers(ctx context.Context, work
|
||||
return 0, errors.New("concurrent workers must at least be 1")
|
||||
}
|
||||
|
||||
if workers > 1 && drivers.DatabaseDriver() == drivers.DatabaseDriverSqlite {
|
||||
return 0, errors.New("multiple workers not supported for SQLite databases")
|
||||
}
|
||||
|
||||
if err := r.Database.Session(&gorm.Session{AllowGlobalUpdate: true}).Model(&models.SiteInfo{}).Update("concurrent_workers", workers).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user