mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
[Files Refactor] Performance tuning (#2813)
* Do database txn in same thread. Retry on locked db * Remove captions from slimscenedata * Fix tracing * Use where in instead of individual selects * Remove scenes_query view * Remove image query view * Remove gallery query view * Use where in for FindMany * Don't interrupt scanning zip files * Fix image filesize sort
This commit is contained in:
@@ -44,6 +44,7 @@ func Test_imageQueryBuilder_Create(t *testing.T) {
|
||||
GalleryIDs: []int{galleryIDs[galleryIdxWithImage]},
|
||||
TagIDs: []int{tagIDs[tagIdx1WithImage], tagIDs[tagIdx1WithDupName]},
|
||||
PerformerIDs: []int{performerIDs[performerIdx1WithImage], performerIDs[performerIdx1WithDupName]},
|
||||
Files: []*file.ImageFile{},
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -193,9 +194,12 @@ func Test_imageQueryBuilder_Update(t *testing.T) {
|
||||
Files: []*file.ImageFile{
|
||||
makeImageFileWithID(imageIdxWithGallery),
|
||||
},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
GalleryIDs: []int{},
|
||||
TagIDs: []int{},
|
||||
PerformerIDs: []int{},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -206,9 +210,12 @@ func Test_imageQueryBuilder_Update(t *testing.T) {
|
||||
Files: []*file.ImageFile{
|
||||
makeImageFileWithID(imageIdxWithGallery),
|
||||
},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
GalleryIDs: []int{},
|
||||
TagIDs: []int{},
|
||||
PerformerIDs: []int{},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -219,9 +226,12 @@ func Test_imageQueryBuilder_Update(t *testing.T) {
|
||||
Files: []*file.ImageFile{
|
||||
makeImageFileWithID(imageIdxWithTag),
|
||||
},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
GalleryIDs: []int{},
|
||||
TagIDs: []int{},
|
||||
PerformerIDs: []int{},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -232,9 +242,12 @@ func Test_imageQueryBuilder_Update(t *testing.T) {
|
||||
Files: []*file.ImageFile{
|
||||
makeImageFileWithID(imageIdxWithPerformer),
|
||||
},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
GalleryIDs: []int{},
|
||||
TagIDs: []int{},
|
||||
PerformerIDs: []int{},
|
||||
Organized: true,
|
||||
CreatedAt: createdAt,
|
||||
UpdatedAt: updatedAt,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -403,6 +416,9 @@ func Test_imageQueryBuilder_UpdatePartial(t *testing.T) {
|
||||
Files: []*file.ImageFile{
|
||||
makeImageFile(imageIdx1WithGallery),
|
||||
},
|
||||
GalleryIDs: []int{},
|
||||
TagIDs: []int{},
|
||||
PerformerIDs: []int{},
|
||||
},
|
||||
false,
|
||||
},
|
||||
@@ -596,7 +612,9 @@ func Test_imageQueryBuilder_UpdatePartialRelationships(t *testing.T) {
|
||||
Mode: models.RelationshipUpdateModeRemove,
|
||||
},
|
||||
},
|
||||
models.Image{},
|
||||
models.Image{
|
||||
GalleryIDs: []int{},
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
@@ -2398,7 +2416,7 @@ func TestImageQuerySorting(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"file size",
|
||||
"size",
|
||||
"filesize",
|
||||
models.SortDirectionEnumDesc,
|
||||
-1,
|
||||
-1,
|
||||
|
||||
Reference in New Issue
Block a user