Use async requests on generateSgv

Created on 7 June 2024, 6 months ago
Updated 15 June 2024, 5 months ago

Problem/Motivation

When the cache is empty, the search in the field type takes too long. The problem is the HUGE amount of API calls we need to use in order to show the preview.

Steps to reproduce

Just Remove the cache in public::/iconify-icons, and try to add any content in an iconify field.

Proposed resolution

Use async capabilities of PHP (read this https://gorannikolovski.com/blog/asynchronous-and-concurrent-http-reques...)

In the generateSvg we should pass an array of icon names, so:
public function generateSvg(string $collection, string $icon_name, array $parameters = []): string {
should be moved to
public function generateSvg(string $collection, array $icons, array $parameters = []): string {

So we should pass into the $icons paramater all the icons that belongs to the same collection.

Inside the method:

We should do all the API requests asynchronously (using a loop), and wait for all the promises.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain alvar0hurtad0 Cáceres

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024