Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All requests blocked while generating image transforms #178

Open
eablokker opened this issue Apr 25, 2023 · 0 comments
Open

All requests blocked while generating image transforms #178

eablokker opened this issue Apr 25, 2023 · 0 comments
Labels

Comments

@eablokker
Copy link

Description

When using image transforms in the element api, all other requests to the website are blocked until all image transforms are finished generating.

Steps to reproduce

  1. Use transforms in the element api
  2. Make sure transformed images haven't been created yet
$images = [];
foreach ($entry->images as $asset) {
	$images[] = [
		'title' => $asset->title,
		'url' => $asset->getUrl($customAssetTransform_1),
		'sizes' => [
			$asset->getUrl($customAssetTransform_2),
			$asset->getUrl($customAssetTransform_3)
		]
	];
}
  1. Request element from the API
  2. Wait long time for response as transforms are being generated
  3. Try to access website while waiting

Suggest returning transform creation URLs in the first response and not caching the response. Wait to cache the response until a request is made when all the images have been created and their actual URLs can be returned. Similar to Craft's Twig {% cache %} tag.

Additional info

  • Craft version: 3.8.5
  • PHP version: 7.4.21
  • Database driver & version: MySQL 5.7.34
  • Plugins & versions: Element API 2.8.5
@eablokker eablokker added the bug label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant