Page MenuHomePhabricator

Calls to api/getRequestSchema vuex action can race with each other
Closed, ResolvedPublicBUG REPORT

Description

There is code in getOperationSchema (which is called by getRequestSchema) that is intended to allow reuse of a previously fetched schema. This code however is fragile in that it makes an immediate check to see if the schema has already been fetched, but is not coded in a way that would await the result if a request is currently in flight.

Instead of the current if ( context.state.specLoaded ) guard, something like the context.state.userPromise system in our user vuex module should be used so that multiple requests can await the Promise that fetches the schema.

Event Timeline

bd808 triaged this task as High priority.Mar 23 2022, 10:26 PM
bd808 moved this task from Backlog to Groomed/Ready on the Toolhub board.

Marking as high because the new T298964: There should be a way to add a tool to a list from any of the tool views feature can trigger a large number of parallel requests for /api/schema/ on the initial site load (basically one per tool per featured list on the landing page).

Slst2020 added a project: User-Slst2020.
Slst2020 moved this task from To Do to Doing on the User-Slst2020 board.
Slst2020 changed the task status from Open to In Progress.Mar 24 2022, 1:04 PM

Change 773513 had a related patch set uploaded (by Slavina Stefanova; author: Slavina Stefanova):

[wikimedia/toolhub@main] ui: Prevent race condition on calls to api/getRequestSchema

https://gerrit.wikimedia.org/r/773513

Slst2020 changed the task status from In Progress to Open.Mar 24 2022, 2:22 PM
Slst2020 moved this task from In Progress to Review on the Toolhub board.

Change 773513 merged by jenkins-bot:

[wikimedia/toolhub@main] ui: Prevent race condition on calls to api/getRequestSchema

https://gerrit.wikimedia.org/r/773513

Change 786342 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production

https://gerrit.wikimedia.org/r/786342

Change 786342 merged by jenkins-bot:

[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production

https://gerrit.wikimedia.org/r/786342