Skip to content

fix: run the loader once for concurrent loads of a collection - #7

Merged
thetutlage merged 1 commit into
1.xfrom
fix/share-concurrent-loads
Nov 23, 2026
Merged

thetutlage merged 1 commit into
1.xfrom
fix/share-concurrent-loads

Conversation

@thetutlage

Copy link
Copy Markdown
Member

Concurrent calls to Collection.load() each ran the loader, because hydrate() keeps the data only after a load finishes.

The website's build:static renders about 60 pages at once. When the weekly cache of ossStats expired, each page fetched the npm download counts, and the npm downloads API rejected the burst. The Cloudflare build of thetutlage/adonis-new-public-website#3 failed this way.

Now concurrent calls share the load in progress, so the loader runs once. A failed load is not kept, so the next call runs the loader again.

Tests cover both cases. The concurrent-load test fails without the change.

Concurrent calls to load() each ran the loader, because the data is kept only after a load finishes. A static build that renders many pages at once fetched the same remote data once per page, and the npm downloads API rejected the burst. Concurrent calls now share the load in progress. A failed load is not kept, so the next call runs the loader again.
@thetutlage thetutlage added the status: incoming The status of the hub task label Nov 23, 2026
@thetutlage
thetutlage merged commit 769de60 into 1.x Nov 23, 2026
10 checks passed
@thetutlage
thetutlage deleted the fix/share-concurrent-loads branch November 23, 2026 09:40
@thetutlage thetutlage added status: discarded The status of the hub task and removed status: incoming The status of the hub task labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: discarded The status of the hub task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant