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 17:32:22 -06: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 18:41:56 -05:00
}
}
2023-09-14 10:46:59 -05:00
// this should be run regularly ... like, every 5 minutes
2023-11-21 17:32:22 -06: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 09:21:04 -05:00
}
}