magento / magento/inventory

`ReindexAfterSourceItemsDeletePlugin` triggers a full stock reindex for a single source removal

Open
#2,936 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1.2-develop Event: Global-Contribution-Day Performance
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Summary
When removing products from sources, a full stock reindex is triggered, courtesy of `ReindexAfterSourceItemsDeletePlugin`.

This may make sense when doing a mass import ("Delete"), but causes performance issues and table contention during standard product maintenance, (reindexing all stocks for a source when one product has changed does not make sense).

### Examples

### Proposed solution
Convert `ReindexAfterSourceItemsDeletePlugin` to call the `sourceItemIndexer`

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 with ReindexAfterSourceItemsDeletePlugin and inspect how it currently triggers stock reindexing. Then trace the sourceItemIndexer entry point named in the proposal. Done means a single source-item removal uses the targeted indexer instead of triggering a full stock reindex; no test file is mentioned, so identify the relevant coverage while tracing the implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.