Skip to content

fix: reduce load of simultaneous queries to kotahi server

Ben Whitmore requested to merge reduce-simultaneous-queries-20240215 into main

Flax was making duplicate, unnecessary queries to Kotahi, and was running a lot of queries in parallel. This resulted in knex timeout errors on the Kotahi server and it was unable to properly respond to the queries, meaning that CMS publishing intermittently failed.

I've fixed this by:

  1. passing the result of getCMSLayout down through the calling tree, rather than re-querying it at multiple points
  2. getting chunks of articles one chunk at a time, rather than all chunks in parallel (this would be a lot of simultaneous queries if there are a lot of published articles)
  3. Skipping an unnecessary preliminary query to determine the total number of articles (totalCount)

Merge request reports