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

BUG: Prevent multiple/parallel imports of external asset source assets #5116

Closed
1 task done
so-grimm opened this issue Jun 3, 2024 · 1 comment · Fixed by #5117
Closed
1 task done

BUG: Prevent multiple/parallel imports of external asset source assets #5116

so-grimm opened this issue Jun 3, 2024 · 1 comment · Fixed by #5117

Comments

@so-grimm
Copy link
Contributor

so-grimm commented Jun 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using an external asset source, assets get imported when they are selected for use via the media selection screen (if they have not previously been imported). To check if an asset needs to be imported, the system checks if the asset already has a localAssetIdentifier. If it doesn't have the localAssetIdentifier, the importAction() of the Neos\Media\Browser\Controller\AssetProxyController is triggered.

The import process takes a few moments. Once it finishes, the asset is selected an the media selection screen closes. The user does not get any feedback about any background processes running and is not blocked from clicking on the asset again. Since editors tend to be impatient, this leads to them clicking on the asset multiple times, triggering the import multiple times and leading to several versions of the same asset being imported into the database.

Expected Behavior

An asset import process should only be triggered once. After it started running, it should not allow another import process to be started for the same asset.

We already discussed a few ideas for how to implement that. The best way seems to be to have a process queue/stack.
We were also thinking that it might be a good idea to have a cleanup command for projects that already have that problem, so the database doesn't have redundant assets.

Steps To Reproduce

  1. implement a remote asset source
  2. find an asset that has not yet been imported (you can check that with the browser tools -> data-local-asset-identifier should not have a value)
  3. select that asset for use via the media selection screen and click on it multiple times before the selection screen closes
  4. check the neos_media_domain_model_importedasset table in your database, counting the entries for each remoteassetidentifier (SELECT remoteassetidentifier, count(*) FROM neos_media_domain_model_importedasset GROUP BY remoteassetidentifier ORDER BY count(*) DESC;)

Environment

- Flow: 8.3
- Neos: 8.3
- PHP: 8.2

Anything else?

No response

@so-grimm so-grimm added the Bug label Jun 3, 2024
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jun 3, 2024
- `select.js`: add data attribute `data-import-in-process` to asset once import process has started and remove it when import is done
- `select.js`: check for new data attribute and only start import process if attribute does not exist
- `select.js`: add notification to inform user that asset is being imported
- `select.js`: add notification as warning for user if import is already in process
- `Main.xlf`: add new notification messages for english
- `Default.html`: add id for notification container to be able to send notifications to it via js
- `Configuration.js`: update `hasConfiguration` after configuration object was created, because otherwise it will always be false and the translations don't work

Issue: neos#5116
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jun 3, 2024
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jun 3, 2024
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jun 4, 2024
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jun 5, 2024
@ahaeslich
Copy link
Member

Thx for taking care

@ahaeslich ahaeslich added the 8.3 label Jun 5, 2024
neos-bot pushed a commit to neos/media-browser that referenced this issue Jun 5, 2024
- `select.js`: add data attribute `data-import-in-process` to asset once import process has started and remove it when import is done
- `select.js`: check for new data attribute and only start import process if attribute does not exist
- `select.js`: add notification to inform user that asset is being imported
- `select.js`: add notification as warning for user if import is already in process
- `Main.xlf`: add new notification messages for english
- `Default.html`: add id for notification container to be able to send notifications to it via js
- `Configuration.js`: update `hasConfiguration` after configuration object was created, because otherwise it will always be false and the translations don't work

Issue: neos/neos-development-collection#5116
neos-bot pushed a commit to neos/media-browser that referenced this issue Jun 5, 2024
neos-bot pushed a commit to neos/media-browser that referenced this issue Jun 5, 2024
neos-bot pushed a commit to neos/neos that referenced this issue Jun 5, 2024
- `select.js`: add data attribute `data-import-in-process` to asset once import process has started and remove it when import is done
- `select.js`: check for new data attribute and only start import process if attribute does not exist
- `select.js`: add notification to inform user that asset is being imported
- `select.js`: add notification as warning for user if import is already in process
- `Main.xlf`: add new notification messages for english
- `Default.html`: add id for notification container to be able to send notifications to it via js
- `Configuration.js`: update `hasConfiguration` after configuration object was created, because otherwise it will always be false and the translations don't work

Issue: neos/neos-development-collection#5116
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jul 18, 2024
so-grimm added a commit to queoGmbH/neos-development-collection that referenced this issue Jul 18, 2024
neos-bot pushed a commit to neos/neos that referenced this issue Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants