Using summaries table for improved performance.

This commit is contained in:
DebaucheryLibrarian
2023-07-17 01:59:26 +02:00
parent 2783de5272
commit 2b3b2d7fd2
191 changed files with 198 additions and 80 deletions

View File

@@ -234,10 +234,12 @@ async function fetchEntitiesBySlug(entitySlugs, prefer = 'channel') {
ORDER BY entity->'type' :sort;
`, {
entitySlugs: entitySlugs.filter((slug) => !slug.includes('.')),
entityHosts: entitySlugs.filter((slug) => slug.includes('.')).map((hostname) => `%${hostname}%`),
entityHosts: entitySlugs.filter((slug) => slug.includes('.')).map((hostname) => `%${hostname}`),
sort: knex.raw(prefer === 'channel' ? 'asc' : 'desc'),
});
console.log(entities.rows);
// channel entity will overwrite network entity
const entitiesBySlug = entities.rows.reduce((accEntities, { entity }) => {
const host = urlToHostname(entity.url);

View File

@@ -270,7 +270,7 @@ async function updateSceneSearch(releaseIds) {
await bulkInsert('releases_search', documents.rows, ['release_id']);
}
await knex.raw('REFRESH MATERIALIZED VIEW CONCURRENTLY releases_not_showcased;');
await knex.raw('REFRESH MATERIALIZED VIEW CONCURRENTLY releases_summaries;');
}
async function storeChapters(releases) {