Using summaries table for improved performance.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user