Skip to content

Commit

Permalink
Improved tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Albermonte committed Jun 11, 2024
1 parent 0bcd399 commit 59aa906
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default defineNuxtConfig({
},

scheduledTasks: {
'0 */12 * * *': ['fetch']
'0 */12 * * *': ['fetch', 'seed', 'score'],
}
},

Expand Down
2 changes: 1 addition & 1 deletion server/database/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type ValidatorParams = Record<
*/
export async function getMissingEpochs(range: Range) {
const existingEpochs = await useDrizzle()
.select({ epochBlockNumber: tables.activity.epochBlockNumber })
.selectDistinct({ epochBlockNumber: tables.activity.epochBlockNumber })
.from(tables.activity)
.where(and(gte(tables.activity.epochBlockNumber, range.fromEpoch), lte(tables.activity.epochBlockNumber, range.toEpoch)))
.execute().then(r => r.map(r => r.epochBlockNumber))
Expand Down
2 changes: 1 addition & 1 deletion server/tasks/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ export default defineTask({
await storeActivities(epochsActivities);
}

return { result: `Task initialized` }
return { result: `${epochBlockNumbers.length} epochs fetched` }
},
})
2 changes: 1 addition & 1 deletion server/tasks/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getValidatorParams, storeScores } from '../database/utils'
export default defineTask({
meta: {
name: "db:compute-score",
description: "computes the VTS score",
description: "Computes the VTS score",
},
async run() {
consola.info("Running db:compute-score task...")
Expand Down

0 comments on commit 59aa906

Please sign in to comment.