Skip to content

Commit

Permalink
feat(check): reduce crawling burden
Browse files Browse the repository at this point in the history
  • Loading branch information
Molmin committed Mar 11, 2024
1 parent 4325de3 commit af9f35e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hydrooj-problem-transmission/src/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ async function main() {
ensureDirSync('data/tmp')
const pids = await service.listProblems()
await Promise.all(pids.map((pid) => queue.waitForTask(async () => {
await new Promise((resolve) => setTimeout(resolve, 1000) as any)
if (pids.filter((id) => pid < id).length > 10) {
if (Math.random() < 0.8) {
console.info(`Skipped problem ${pid}`)
return
}
}
await new Promise((resolve) => setTimeout(resolve, 5000) as any)
data[pid] = {
englishName: '',
maxSampleId: 0,
Expand Down

0 comments on commit af9f35e

Please sign in to comment.