From 7ceec1c739c7b2dad5b8855f7631e151b141a53b Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 24 Jan 2022 00:15:11 +0100 Subject: [PATCH] Added indexes to scene tag and movie scene tables improve performance. Removed scene count from channel overview, too expensive. --- assets/components/entities/tile.vue | 7 +++++-- assets/js/entities/actions.js | 6 ------ migrations/20220123234131_scene_indexes.js | 15 +++++++++++++++ src/scrapers/traxxx.js | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 migrations/20220123234131_scene_indexes.js diff --git a/assets/components/entities/tile.vue b/assets/components/entities/tile.vue index 5da4f0a9..f03a606f 100644 --- a/assets/components/entities/tile.vue +++ b/assets/components/entities/tile.vue @@ -40,8 +40,11 @@ >{{ entity.name }} - - {{ entity.sceneTotal }} scenes + + {{ entity.sceneTotal }} scenes {{ entity.childrenTotal }} channels diff --git a/assets/js/entities/actions.js b/assets/js/entities/actions.js index 5d0341dd..88ad3c4a 100644 --- a/assets/js/entities/actions.js +++ b/assets/js/entities/actions.js @@ -194,12 +194,6 @@ function initEntitiesActions(store, router) { url independent hasLogo - children: childEntitiesConnection { - totalCount - } - connection: scenesConnection { - totalCount - } } } `, { diff --git a/migrations/20220123234131_scene_indexes.js b/migrations/20220123234131_scene_indexes.js new file mode 100644 index 00000000..07d6b7cb --- /dev/null +++ b/migrations/20220123234131_scene_indexes.js @@ -0,0 +1,15 @@ +exports.up = async (knex) => Promise.resolve() + .then(() => knex.schema.alterTable('releases_tags', (table) => { + table.index('release_id'); + })) + .then(() => knex.schema.alterTable('movies_scenes', (table) => { + table.index('scene_id'); + })); + +exports.down = async (knex) => Promise.resolve() + .then(() => knex.schema.alterTable('releases_tags', (table) => { + table.dropIndex('release_id'); + })) + .then(() => knex.schema.alterTable('movies_scenes', (table) => { + table.dropIndex('scene_id'); + })); diff --git a/src/scrapers/traxxx.js b/src/scrapers/traxxx.js index cc3db3d6..dcd1aedd 100644 --- a/src/scrapers/traxxx.js +++ b/src/scrapers/traxxx.js @@ -262,7 +262,7 @@ async function fetchLatest(entity, page, options) { .select('name') .where('priority', '>', 7) .orderByRaw('random()') - .limit(faker.datatype.number({ min: 2, max: 15 })) + .limit(faker.datatype.number({ min: 15, max: 25 })) .pluck('name'); release.actors = [...actors(release), null]; // include empty actor to ensure proper handling