grist-core icon indicating copy to clipboard operation
grist-core copied to clipboard

FIX slowness when adding user to workspace

Open hexaltation opened this issue 5 months ago • 4 comments

Context

On French administration we can experience instances not beeing able to add users to workspaces due to long queries, and never ending queries.

Proposed solution

https://github.com/gristlabs/grist-core/commit/e26673eff10e93f7383f09886affdd999a2ecde4

To fix this issue we propose the same strategy than in #824. Splitting the query in to simpler queries to gather informations about workspace and organization.

https://github.com/gristlabs/grist-core/commit/bd43d12110c3ae33fa793b1d658e1a5c630a186a We also propose to remove the promisyfyAll around iteration of getUsers queries. During local test, it seems to be the main culprit. The ForEach iteration launches asynchonously many queries recycling the same transaction. Sometime the transaction never ended.

https://github.com/gristlabs/grist-core/commit/3c6388cb165fe79dbff57454caf2014247bfb53e Cause the newly added function getExistingUsersByLogin uses a WHERE on logins.email a INDEX is added to allow fastest queries.

Related issues

FIXES #1005

Has this been tested?

  • [ ] 👍 yes, I added tests to the test suite
  • [ ] 💭 no, because this PR is a draft and still needs work
  • [x] 🙅 no, because this is not relevant here
  • [ ] 🙋 no, because I need help

hexaltation avatar Sep 11 '24 15:09 hexaltation