Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-source-drupal): Ensure node updates are handled sequentially to avoid race conditions when saving nodes #36026

Merged
merged 4 commits into from
Jul 13, 2022

Conversation

KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Jun 30, 2022

#35323 changed how we persisted references — because of that some functions had to become async but we didn't properly update all code to await. We also ran node updates in parallel instead of sequentially. This meant that sites with many references could experience a race condition where some changes aren't applied correctly as we update the nodes multiple times during the incremental source for each reference change and an older version might overwrite a newer as the updates were happening in parallel instead of sequentially.

This PR properly awaits everything + changes our mocked cache for tests to also be async to avoid any similar regressions happening in the future.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 30, 2022
@KyleAMathews KyleAMathews changed the title fix(gatsby-source-drupal): Properly await async functions to avoid race conditions while saving nodes Jun 30, 2022
@KyleAMathews KyleAMathews added topic: source-drupal Related to Gatsby's integration with Drupal and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 30, 2022
"links": {
"self": {
"href":
"https://dev-drupal-bug-reproduction.pantheonsite.io/jsonapi/node/page/6a5db0d4-4a0f-4a4b-9048-7d26e29fdacb?resourceVersion=id%3A13"
Copy link

Choose a reason for hiding this comment

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

Did you want the fixtures to have this URL in place?

Copy link
Contributor Author

@KyleAMathews KyleAMathews Jun 30, 2022

Choose a reason for hiding this comment

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

Meh it doesn't matter much. We discard that from the JSON:API when processing it anyways. And the site is a throwaway.

@LekoArts LekoArts added the topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) label Jul 1, 2022
@KyleAMathews KyleAMathews merged commit 428355c into master Jul 13, 2022
@KyleAMathews KyleAMathews deleted the drupal-relationship-fix branch July 13, 2022 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-drupal Related to Gatsby's integration with Drupal topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem)
4 participants