liip / liip/LiipImagineBundle

Add the option to use Symfony locks

Open
#1,604 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.7k
Forks
386
Avg merge
1d 10h
Merged PRs (30d)
3

Description

**Is your feature request related to a problem? Please describe.**
When a user uploads a pretty large image that takes some time to generate a thumbnail for and said user keeps on hitting f5 on the page because the image is not loading (it is being generated) multiple processes try to generate the thumbnail, one for each reload. Because the image processing on its own can eat up RAM quite well you can run into the issue that you php-fpm process gets killed to recover memory, because otherwise the server would crash

**Describe the solution you'd like**
Add the option to use the [Symfony lock component](https://symfony.com/doc/current/components/lock.html) so each image can only be processed by exactly one process at a time

**Describe alternatives you've considered**
I though about triggering the generation on uploading the image and that might help, but it doesn't really solve the issue

**Additional context**
https://github.com/MbinOrg/mbin

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the bundle's thumbnail-generation flow and the Symfony Lock component documentation linked in the issue. Determine where concurrent processing for the same image is initiated. Done means the bundle offers an option that ensures only one process generates a given image at a time, while other requests avoid duplicate processing.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.