Skip to content

Commit 91e5016

Browse files
committed
Use p-limit and tsx
1 parent 04f6687 commit 91e5016

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/conference-sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
- name: Sync conference data from Sched
1616
run: |
17-
node --experimental-transform-types scripts/sync-sched/sync.ts --year 2025
17+
tsx scripts/sync-sched/sync.ts --year 2025
1818
1919
- name: Commit changes
2020
uses: stefanzweifel/git-auto-commit-action@v5

scripts/sync-sched/sync.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import assert from "node:assert"
44
import { parseArgs } from "node:util"
55
import { join } from "node:path"
66
import { readFile, writeFile } from "node:fs/promises"
7+
import pLimit from "p-limit"
78

89
import {
910
getSchedule,
@@ -159,8 +160,11 @@ async function updateSpeakerDetails(
159160

160161
const toUpdate = byUpdateTime.slice(0, quota)
161162

163+
const limit = pLimit(5)
162164
const updated = await Promise.all(
163-
toUpdate.map(speaker => getSpeakerDetails(ctx, speaker.username)),
165+
toUpdate.map(speaker =>
166+
limit(() => getSpeakerDetails(ctx, speaker.username)),
167+
),
164168
)
165169

166170
for (const speaker of updated) {

0 commit comments

Comments
 (0)