On my CBuilder profiles, I use two CB fields (php code), doing a curl request upon the API of a group mail provider (GaggleEmail).
The point is, at least on the first call, their API is slow to answer, causing CBuilder profile being also slow to display profile.
The joomla debug mode shows that the afterRenderComponent called by CBuilder is slow - because of the external curl call not CBuilder of course...
Is there a way to avoid that ? Something like defering the external API answer once CBuilder profile... I thought about an external file with a json call or something like that... maybe you may have a suggestion ?
PHP isn't async so no not without pushing it to a completely separate process. Common solutions for this are to make PHP async with something like swoole, using a processing queue (e.g. Joomla task scheduler is somewhat a processing queue), offloading it to a separate request (e.g. make the API call from javascript on next render or an HTTP request to a separate process that then makes the cURL call).
We don't have any out of the box solutions for dealing with this at this time. CB 3.x we'll be implementing a processing queue that should be able to easily handle deferring processing, but for now you can probably try creating a Joomla scheduled task for your cURL request (CB Auto Actions provides a scheduler task so you can run auto actions on a schedule as well!) or review running a separate process either from a GET request to a custom endpoint or from javascript.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.