[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:
WithoutPants
2022-08-11 16:14:57 +10:00
parent 87167736f6
commit 9b31b20fed
19 changed files with 715 additions and 680 deletions

View File

@@ -51,6 +51,7 @@ func Test_galleryQueryBuilder_Create(t *testing.T) {
SceneIDs: []int{sceneIDs[sceneIdx1WithPerformer], sceneIDs[sceneIdx1WithStudio]},
TagIDs: []int{tagIDs[tagIdx1WithScene], tagIDs[tagIdx1WithDupName]},
PerformerIDs: []int{performerIDs[performerIdx1WithScene], performerIDs[performerIdx1WithDupName]},
Files: []file.File{},
},
false,
},
@@ -202,9 +203,12 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
Files: []file.File{
makeGalleryFileWithID(galleryIdxWithImage),
},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
SceneIDs: []int{},
TagIDs: []int{},
PerformerIDs: []int{},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
},
false,
},
@@ -215,9 +219,12 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
Files: []file.File{
makeGalleryFileWithID(galleryIdxWithScene),
},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
SceneIDs: []int{},
TagIDs: []int{},
PerformerIDs: []int{},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
},
false,
},
@@ -228,9 +235,12 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
Files: []file.File{
makeGalleryFileWithID(galleryIdxWithTag),
},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
SceneIDs: []int{},
TagIDs: []int{},
PerformerIDs: []int{},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
},
false,
},
@@ -241,9 +251,12 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
Files: []file.File{
makeGalleryFileWithID(galleryIdxWithPerformer),
},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
SceneIDs: []int{},
TagIDs: []int{},
PerformerIDs: []int{},
Organized: true,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
},
false,
},
@@ -428,6 +441,9 @@ func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
Files: []file.File{
makeGalleryFile(galleryIdxWithImage),
},
SceneIDs: []int{},
TagIDs: []int{},
PerformerIDs: []int{},
},
false,
},
@@ -621,7 +637,9 @@ func Test_galleryQueryBuilder_UpdatePartialRelationships(t *testing.T) {
Mode: models.RelationshipUpdateModeRemove,
},
},
models.Gallery{},
models.Gallery{
SceneIDs: []int{},
},
false,
},
{