mohan-devstack / magento2-product-queue-save
Magento 2 module — Save all product types asynchronously via message queue (simple, configurable, grouped, bundle, downloadable). No browser timeouts.
Mohan_ProductQueueSave — Magento 2 Async Product Save
A Magento 2 module that adds a "Save via Queue & Close" button to the admin product edit page. Instead of saving the product synchronously (which can time out on large catalogues or configurable products with many variations), it pushes the save operation onto Magento's message queue and processes it in the background via a long-running PHP consumer.
Features
- Async product save via
Magento_MessageQueue— no browser timeout - Full support for:
- Simple and configurable products
- Variation creation and sync (status, price, qty, images)
- Media gallery — new uploads, role assignment, image removal
- Tier prices
- Custom options
- Related / upsell / cross-sell links
- Category assignments
- Website assignments
- Stock (qty, in-stock flag)
- Admin queue log grid — see pending, processing, success, and failed jobs
- Nightly cleanup cron — removes completed queue messages automatically (keeps DB size in check)
- CLI status command:
bin/magento mohan:product-queue:status
Requirements
| Dependency | Version |
|---|---|
| PHP | ≥ 8.1 |
| Magento | 2.4.x |
magento/module-catalog |
* |
magento/module-configurable-product |
* |
magento/module-catalog-inventory |
* |
Installation
Via Composer (recommended)
composer require mohan-devstack/magento2-product-queue-save
php bin/magento module:enable Mohan_ProductQueueSave
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
Manual
- Copy the
Mohan/ProductQueueSavedirectory intoapp/code/Mohan/ProductQueueSave/ - Run:
php bin/magento module:enable Mohan_ProductQueueSave
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
Configuration
Go to Stores → Configuration → Mohan → Product Queue Save.
| Setting | Description | Default |
|---|---|---|
| Enable Module | Show/hide the queue save button | Yes |
| Max Retry Attempts | How many times a failed job is retried | 3 |
Starting the Queue Consumer
The consumer is a long-running PHP process. Start it on your server:
php bin/magento queue:consumers:start mohan.product.queue.save.consumer
For production, manage it with Supervisor so it restarts automatically on crash:
[program:mohan_product_queue]
command=php /var/www/html/magento/bin/magento queue:consumers:start mohan.product.queue.save.consumer
user=www-data
autostart=true
autorestart=true
stderr_logfile=/var/log/mohan_product_queue.err.log
stdout_logfile=/var/log/mohan_product_queue.out.log
Usage
- Open any product in the Magento admin.
- Make your changes.
- Click "Save via Queue & Close" (next to the standard Save button).
- You are redirected to the product grid immediately — the save happens in the background.
- Monitor progress at Catalog → Product Queue Log.
Queue Log Grid
The admin grid at Catalog → Product Queue Log shows every queued save with:
- Product ID and SKU
- Status:
pending→processing→success/failed - Timestamp and error message (on failure)
How It Works
[Admin clicks button]
│
▼
Controller (Queue/Save)
→ Collects full product POST data
→ Publishes JSON message to queue topic: mohan.product.queue.save
→ Returns success immediately → browser redirects to grid
│
▼
Queue Consumer (long-running CLI process)
→ Unserializes message
→ Loads existing product from repository
→ Applies: stock, tier prices, links, custom options, gallery, categories
→ productRepository->save()
→ For configurables: creates/syncs child variations, saves images per variation
→ Marks log entry as success / failed
Why not just use standard save?
Magento's synchronous product save can take 30–120 seconds for:
- Configurable products with 50+ variations
- Products with large media galleries (100+ images)
- Catalogues with deep category trees
This module moves that work off the HTTP request entirely.
Database Table
The module creates one table: mohan_product_queue_log
| Column | Type | Description |
|---|---|---|
log_id |
int | Primary key |
message_id |
varchar(64) | Unique queue message ID |
product_id |
int | Catalog product entity ID |
sku |
varchar(64) | Product SKU |
status |
varchar(32) | pending / processing / success / failed / retry |
store_id |
smallint | Store scope of the save |
admin_user_id |
int | Admin who triggered the save |
error_message |
text | Error detail on failure |
retry_count |
smallint | Number of retries attempted |
created_at |
timestamp | When the job was queued |
processed_at |
timestamp | When it completed |
Cleanup Cron
A nightly cron (0 3 * * *) automatically:
- Deletes completed
queue_message/queue_message_statusrows for this module's queue —queue_message.bodyislongtextand grows large with image data. - Trims
mohan_product_queue_log: success entries older than 30 days, failed/retry entries older than 90 days.
CLI Command
Check queue status from the command line:
php bin/magento mohan:product-queue:status
Known Limitations
- New image uploads: The source
.tmpfile must still exist on disk when the consumer runs. If Magento'sremove_old_catalog_images_from_cachecron cleans the tmp directory before the consumer processes the message, the image will be skipped (product still saves, just without the new image). This is unlikely in practice but worth noting for very busy queues. - Retry: Automatic retry is intentionally disabled. A retry would re-publish the queue message, but the original payload is not stored in the log table, so retrying with an empty payload would wipe tier prices and product links. Manual re-save is the safe path until full payload persistence is implemented.
License
MIT © Mohan
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
Requires 7
| Package | Constraint |
|---|---|
| magento/framework | * |
| magento/module-backend | * |
| magento/module-catalog | * |
| magento/module-catalog-inventory | * |
| magento/module-configurable-product | * |
| magento/module-store | * |
| php | >=8.1 |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from mohan-devstack
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.