You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a general issue with the way Ember-Data works, but it has especially been showing up on the pages that display individual contacts.
Display of an individual contact in Fabrica (/contacts/:id) can result in many individual API requests to load all of the related provider contacts. For example https://doi.stage.datacite.org/contacts/ca485a42-c5b1-4f5c-8464-c6d8a753f27c (see the screenshot) loads numerous contacts even though only one is needed.
This causes slowness and timeouts in some Fabrica pages, and an unnecessary load on the REST API.
This has to do with the belongsTo/hasMany model relationship , especially when the 'async' is set to true for the relationship:
Other developers have reported this as an issue with Ember and have been promised future improvements. A workaround is to have an adapter that can 'coalesce' these separate API calls into 1 API call, but the API has to be designed for it. There may be a way to restructure the code to avoid this situation.
This has caused timeouts in our test suites due to the build up of unused contacts over time. The workaround there has been to have tests clean up unused contacts at the end of the run.
Finally, this happens with other model relationships in Fabrica, for instance many repository records can be loaded on the page which displays a single repository.
The text was updated successfully, but these errors were encountered:
svogt0511
changed the title
Fabrica page slowness and timeouts on certain pages due to model relationships that cause unnecessary API calls
Fabrica slowness and timeouts on certain pages due to model relationships that cause unnecessary API calls
Aug 23, 2023
This is a general issue with the way Ember-Data works, but it has especially been showing up on the pages that display individual contacts.
Display of an individual contact in Fabrica (/contacts/:id) can result in many individual API requests to load all of the related provider contacts. For example https://doi.stage.datacite.org/contacts/ca485a42-c5b1-4f5c-8464-c6d8a753f27c (see the screenshot) loads numerous contacts even though only one is needed.
This causes slowness and timeouts in some Fabrica pages, and an unnecessary load on the REST API.
This has to do with the belongsTo/hasMany model relationship , especially when the 'async' is set to true for the relationship:
This happens when findRecord is called in the model hook for records with such relationships, especially if there are a lot of related records.
Other developers have reported this as an issue with Ember and have been promised future improvements. A workaround is to have an adapter that can 'coalesce' these separate API calls into 1 API call, but the API has to be designed for it. There may be a way to restructure the code to avoid this situation.
This has caused timeouts in our test suites due to the build up of unused contacts over time. The workaround there has been to have tests clean up unused contacts at the end of the run.
Finally, this happens with other model relationships in Fabrica, for instance many repository records can be loaded on the page which displays a single repository.
The text was updated successfully, but these errors were encountered: