mohan-devstack / magento2-product-queue-save

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
magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass MIT

Are you the maintainer of mohan-devstack?

Packagento pulls mohan-devstack's Composer packages from the public registry so buyers can find them here.

Claim the namespace to take ownership, publish new releases directly, and start charging for premium versions.

Claim this namespace →

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

  1. Copy the Mohan/ProductQueueSave directory into app/code/Mohan/ProductQueueSave/
  2. 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

  1. Open any product in the Magento admin.
  2. Make your changes.
  3. Click "Save via Queue & Close" (next to the standard Save button).
  4. You are redirected to the product grid immediately — the save happens in the background.
  5. 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: pendingprocessingsuccess / 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:

  1. Deletes completed queue_message / queue_message_status rows for this module's queue — queue_message.body is longtext and grows large with image data.
  2. 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 .tmp file must still exist on disk when the consumer runs. If Magento's remove_old_catalog_images_from_cache cron 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.

Versions
Version Stability QA Status Compatibility Released
v1.0.0 stable Fail Magento 2.4.7-2.4.9 Details 2026-07-10 04:48:48

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.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

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.

Static analysis results
Tool Status Findings Summary
PHPCS Fail 57 2 errors, 55 warnings (ruleset: Magento2), 30 auto-fixable with phpcbf
PHPMD Pass 0
Cpd Pass 0
Composer validate Info 6 valid; 6 advisory notes (composer validate --strict)

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.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 30 30
2.4.8 31 31
2.4.9 31 31

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

Unit tests results by Magento and PHP version
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

Integration tests results by Magento and PHP version
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.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT
Authors

More from mohan-devstack

View vendor
Make it pay

Turn 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.