Problem/Motivation
The Cloudinary plugin writes items after retrieving them from the API to the database storage. But it will never check if the item is inside the DB storage when retrieving them. For pages that only have 1-2 images at most, you will not notice the issue directly but if we have a page with a vast collection it can take over 40 seconds (800ms - 1s per image) for a page to render and load.
Steps to reproduce
Clean install the plugin (2.1.3), and retrieve on a page a huge amount of images, the more the better the result. You will notice an increase in page load when the amount of images increases that are loaded through Cloudinary.
Proposed resolution
The cloudinary_stream_wrapper_resource_prepare code is never called anywhere within the module causing every request for an API call.
Partial patch that resolves this issue with cloudinary_stream_wrapper_load_file, The page I used locally to test took 43 seconds to load before applying the patch and afterward 430ms.
Remaining tasks
Probably still needs additional checks for folders and other options. This was just in our use case the only call necessary to have high performance.
User interface changes
n/a
API changes
n/a
Data model changes
n/a
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | cloudinary-3354894-7.patch | 4.29 KB | klaasvw |
| cloudinary-stream-wrapper-db-storage-patch.patch | 1.24 KB | jneuteboom |
Issue fork cloudinary-3354894
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
b_manRe-published, not spam.
Comment #3
jneuteboomComment #4
jneuteboomSince there has not been a reply here recently on this issue. Just wanted to let you know this issue is still relevant for the new 3.x branch. The patch above is still working without any modifications.
Comment #5
jneuteboomComment #6
klaasvw commentedThere are multiple problems related to this issue:
Uncaught InvalidArgumentException: A path was passed when a fully qualified domain was expectedComment #8
klaasvw commentedAttached is a patch that addresses these issues:
Comment #9
klaasvw commentedBecause #3479652: Avoid overloading admin API addresses similar issues and covers additional areas where cloudinary data can be loaded from the database / cache instead of the API I have incorporated the changes introduced in the initial patch in #3479652: Avoid overloading admin API.