mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
[Files Refactor] Performance tuning (#2819)
* Load scene relationships on demand * Load image relationships on demand * Load gallery relationships on demand * Add dataloaden * Use dataloaders * Use where in for other find many functions
This commit is contained in:
@@ -14,7 +14,7 @@ type FinderImageStashIDGetter interface {
|
||||
Finder
|
||||
GetAliases(ctx context.Context, studioID int) ([]string, error)
|
||||
GetImage(ctx context.Context, studioID int) ([]byte, error)
|
||||
GetStashIDs(ctx context.Context, studioID int) ([]*models.StashID, error)
|
||||
models.StashIDLoader
|
||||
}
|
||||
|
||||
// ToJSON converts a Studio object into its JSON equivalent.
|
||||
@@ -69,9 +69,9 @@ func ToJSON(ctx context.Context, reader FinderImageStashIDGetter, studio *models
|
||||
}
|
||||
|
||||
stashIDs, _ := reader.GetStashIDs(ctx, studio.ID)
|
||||
var ret []*models.StashID
|
||||
var ret []models.StashID
|
||||
for _, stashID := range stashIDs {
|
||||
newJoin := &models.StashID{
|
||||
newJoin := models.StashID{
|
||||
StashID: stashID.StashID,
|
||||
Endpoint: stashID.Endpoint,
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ var stashID = models.StashID{
|
||||
StashID: "StashID",
|
||||
Endpoint: "Endpoint",
|
||||
}
|
||||
var stashIDs = []*models.StashID{
|
||||
&stashID,
|
||||
var stashIDs = []models.StashID{
|
||||
stashID,
|
||||
}
|
||||
|
||||
const image = "aW1hZ2VCeXRlcw=="
|
||||
@@ -107,8 +107,8 @@ func createFullJSONStudio(parentStudio, image string, aliases []string) *jsonsch
|
||||
Image: image,
|
||||
Rating: rating,
|
||||
Aliases: aliases,
|
||||
StashIDs: []*models.StashID{
|
||||
&stashID,
|
||||
StashIDs: []models.StashID{
|
||||
stashID,
|
||||
},
|
||||
IgnoreAutoTag: autoTagIgnored,
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ type NameFinderCreatorUpdater interface {
|
||||
UpdateFull(ctx context.Context, updatedStudio models.Studio) (*models.Studio, error)
|
||||
UpdateImage(ctx context.Context, studioID int, image []byte) error
|
||||
UpdateAliases(ctx context.Context, studioID int, aliases []string) error
|
||||
UpdateStashIDs(ctx context.Context, studioID int, stashIDs []*models.StashID) error
|
||||
UpdateStashIDs(ctx context.Context, studioID int, stashIDs []models.StashID) error
|
||||
}
|
||||
|
||||
var ErrParentStudioNotExist = errors.New("parent studio does not exist")
|
||||
|
||||
Reference in New Issue
Block a user