Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Defering external API calls in CBuilder profile ?

  • agaudin
  • agaudin
  • OFFLINE
  • Posts: 84
  • Thanks: 16
  • Karma: 3
1 month 1 week ago #339578 by agaudin
Hello,

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 ?

If you don't it's not a big deal.

Best regards
Antoine

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
1 month 1 week ago #339579 by krileon
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.
The following user(s) said Thank You: agaudin

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum