Skip to content

Conversation

conico974
Copy link
Collaborator

Right now there is an issue with blockConcurrencyWhile that will make it block for 30s and fail.
When there is too much revalidate request at a fast enough pace, it seems that there is multiple call to blockConcurrencyWhile and they seem to block each other.

This PR fixes it by removing the blockConcurrencyWhile and just waiting for ongoingRevalidation to go below maxRevalidate

Copy link

pkg-pr-new bot commented May 20, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@674

commit: bde2efd


if (this.ongoingRevalidations.size >= this.maxRevalidations) {
if (this.ongoingRevalidations.size > 2 * this.maxRevalidations) {
console.warn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to import warning on line 1?

// We still await the promise to ensure the revalidation is completed
// This is fine because the queue itself run inside a waitUntil
await this.ctx.blockConcurrencyWhile(async () => {
// TODO: need more investigation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you can have a minimal repro and create an issue on the workerd repro and link it here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to work on that. It's a bit tricky to reproduce locally

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple comments

Copy link

changeset-bot bot commented May 20, 2025

🦋 Changeset detected

Latest commit: bde2efd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR


async revalidate(msg: QueueMessage) {
if (this.ongoingRevalidations.size > 2 * this.maxRevalidations) {
console.warn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import warn?

@conico974 conico974 merged commit ec9ea58 into opennextjs:main May 20, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants