stacker.news/worker/views.js

16 lines
621 B
JavaScript
Raw Normal View History

// this is intended to be run everyday after midnight CT
2023-11-21 23:32:22 +00:00
export async function views ({ models }) {
for (const view of ['reg_growth_days', 'spender_growth_days', 'item_growth_days',
'spending_growth_days', 'stackers_growth_days', 'stacking_growth_days',
'user_stats_days']) {
await models.$queryRawUnsafe(`REFRESH MATERIALIZED VIEW CONCURRENTLY ${view}`)
2023-05-18 23:41:56 +00:00
}
}
2023-09-14 15:46:59 +00:00
// this should be run regularly ... like, every 5 minutes
2023-11-21 23:32:22 +00:00
export async function rankViews ({ models }) {
for (const view of ['zap_rank_personal_view']) {
await models.$queryRawUnsafe(`REFRESH MATERIALIZED VIEW CONCURRENTLY ${view}`)
2023-05-23 14:21:04 +00:00
}
}