mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Handle large and all entity queries (#3544)
* Remove upper page size limit * Batch GetMany function * Remove upper query limit from UI
This commit is contained in:
@@ -363,17 +363,23 @@ func (qb *GalleryStore) Find(ctx context.Context, id int) (*models.Gallery, erro
|
||||
}
|
||||
|
||||
func (qb *GalleryStore) FindMany(ctx context.Context, ids []int) ([]*models.Gallery, error) {
|
||||
q := qb.selectDataset().Prepared(true).Where(qb.table().Col(idColumn).In(ids))
|
||||
unsorted, err := qb.getMany(ctx, q)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
galleries := make([]*models.Gallery, len(ids))
|
||||
|
||||
for _, s := range unsorted {
|
||||
i := intslice.IntIndex(ids, s.ID)
|
||||
galleries[i] = s
|
||||
if err := batchExec(ids, defaultBatchSize, func(batch []int) error {
|
||||
q := qb.selectDataset().Prepared(true).Where(qb.table().Col(idColumn).In(batch))
|
||||
unsorted, err := qb.getMany(ctx, q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, s := range unsorted {
|
||||
i := intslice.IntIndex(ids, s.ID)
|
||||
galleries[i] = s
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range galleries {
|
||||
|
||||
Reference in New Issue
Block a user