Fix blockConcurrencyWhile in DO queue#674
Merged
conico974 merged 5 commits intoopennextjs:mainfrom May 20, 2025
Merged
Conversation
commit: |
vicb
reviewed
May 20, 2025
|
|
||
| if (this.ongoingRevalidations.size >= this.maxRevalidations) { | ||
| if (this.ongoingRevalidations.size > 2 * this.maxRevalidations) { | ||
| console.warn( |
Contributor
There was a problem hiding this comment.
do you want to import warning on line 1?
vicb
reviewed
May 20, 2025
| // 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 |
Contributor
There was a problem hiding this comment.
It would be great if you can have a minimal repro and create an issue on the workerd repro and link it here
Collaborator
Author
There was a problem hiding this comment.
I'll try to work on that. It's a bit tricky to reproduce locally
vicb
approved these changes
May 20, 2025
Contributor
vicb
left a comment
There was a problem hiding this comment.
LGTM with a couple comments
🦋 Changeset detectedLatest commit: bde2efd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
vicb
reviewed
May 20, 2025
|
|
||
| async revalidate(msg: QueueMessage) { | ||
| if (this.ongoingRevalidations.size > 2 * this.maxRevalidations) { | ||
| console.warn( |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now there is an issue with
blockConcurrencyWhilethat 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
blockConcurrencyWhileand they seem to block each other.This PR fixes it by removing the
blockConcurrencyWhileand just waiting forongoingRevalidationto go belowmaxRevalidate