Documentation · Troubleshooting

Cron Errors

This document covers problems related to scheduled import automation, including WP-Cron failures, server-cron configuration issues and image queue worker errors.

When to use this document

Read this document when:

  • Automatic imports are not running at the configured schedule.
  • The last import run time displayed on the admin dashboard is not advancing.
  • The plugin log shows no import activity even though automation is enabled.
  • The REST-based cron endpoint is returning errors or not triggering imports.
  • The image queue worker is not processing queued images.

Overview

The plugin supports two import automation modes:

  1. WP-Cron mode (default): imports are triggered by WordPress's built-in pseudo-cron system (wp-cron.php). WP-Cron runs when a WordPress page is loaded; on low-traffic sites it may not fire reliably.
  2. Server-cron mode: a real operating-system cron job calls either wp-cron.php or the plugin's dedicated REST endpoint at a fixed interval. This is more reliable and is recommended for production sites.

Both modes use the same shared import runner (Scheduler::run_import()). The result is identical regardless of which trigger is used.

Available schedule options

When WP-Cron automation is enabled, the following schedules are available:

Schedule keyInterval
hourlyEvery 60 minutes
as24ci_every_6_hoursEvery 6 hours
twicedailyTwice per day
dailyOnce per day
as24ci_customCustom interval (minimum 15 minutes, configurable)

For daily and twicedaily schedules, a start time (HH:MM, 24-hour format, in the WordPress site timezone) can be configured. The default start time is 06:00.

REST cron endpoint

The plugin registers a REST endpoint that can be called by an external scheduler:

GET /wp-json/as24ci/v1/cron-import

Authentication is required. The preferred method is:

Authorization: Bearer YOUR_TOKEN

The token can also be passed as a query parameter (?token=YOUR_TOKEN), though using the header is recommended to avoid the token appearing in server access logs.

The token is generated automatically and is visible in the plugin's Import & Limits settings tab. You can regenerate it from the same screen.

Image queue worker

During cron and REST import runs, when image queue mode is enabled, the plugin queues remaining vehicle images for asynchronous processing. A separate WP-Cron hook (as24ci_image_queue_process) runs the image queue worker. This worker processes up to 30 images per batch and continues until the queue is empty or the time budget is exhausted. If items remain, it reschedules itself automatically.

Prerequisites

  • Auto-import is enabled in the plugin settings (Import & LimitsAutomation tab).
  • At least one seller ID is configured.
  • The API connection is working. Verify on the System Status page.
  • For server-cron mode: the hosting environment supports scheduled jobs (cron, scheduled tasks, or an equivalent service).

Diagnostic steps

Step 1: Confirm automation is enabled

  1. Go to the plugin Import & LimitsAutomation tab.
  2. Confirm Enable automatic import is toggled on.
  3. Confirm the desired schedule is selected.
  4. Save settings if any changes were made.

Step 2: Check the last run time

  1. On the plugin admin dashboard or System & Help tab, check the Last import run timestamp.
  2. If the timestamp is older than two full schedule intervals, automation is likely not firing.

Step 3: Verify the WP-Cron event is scheduled

For WP-Cron mode:

  1. Use a WordPress plugin that can list scheduled events (for example, WP Crontrol) or WP-CLI: `` wp cron event list ``
  2. Look for the hook as24ci_scheduled_import. Confirm it is present and its next-run time is in the future.
  3. If the hook is absent, re-save the automation settings in the plugin to reschedule it.

Step 4: Verify WP-Cron is working on this site

WP-Cron may be disabled on some hosting environments or by performance plugins:

  1. Check wp-config.php for the line: ``php define('DISABLE_WP_CRON', true); ` If this constant is set to true`, WP-Cron is disabled. You must use a server-cron or the REST endpoint instead.
  2. Confirm that page requests are being made to the site regularly (at least once per schedule interval). On low-traffic sites, WP-Cron may not fire at the expected time.
  3. Use a service that regularly pings your site URL to ensure WP-Cron has opportunities to run, or switch to server-cron mode.

Step 5: Test the REST cron endpoint

If you are using or plan to use the REST endpoint:

  1. Retrieve the cron token from Import & LimitsCron Token section.
  2. Send a test request from your server: `` curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://your-site.example.com/wp-json/as24ci/v1/cron-import" ``
  3. A successful response returns HTTP 200 with "success": true and import counts.
  4. A 403 response indicates an invalid or missing token. Verify the token in the plugin settings.
  5. A 429 response indicates the import is already in progress (lock is active). Wait and retry.
  6. A 500 response indicates an exception during the import run. Check the plugin log for details.

If the REST API is not reachable, confirm that pretty permalinks are enabled (Settings → Permalinks → Save) and that the WordPress REST API is not blocked by a security plugin or server configuration.

Step 6: Verify external cron ping recording

If you are using a server-cron job that calls wp-cron.php directly, you can append ?as24ci_cron=1 to the URL to record the ping:

https://your-site.example.com/wp-cron.php?doing_wp_cron&as24ci_cron=1

The plugin records the timestamp of this ping and displays it on the System & Help tab as the last external cron activity time.

Step 7: Check for a stale import lock

If a previous import run was interrupted without releasing its lock, subsequent runs will be skipped for up to 40 minutes. The log will contain:

Import runner (wp-cron): already in progress, skipping.

If the lock is genuinely stale (the original run is no longer active), wait for the 40-minute TTL to expire. The lock is automatically cleared if it is older than 40 minutes when the next run attempts to start.

To clear the lock immediately:

  • Delete the WordPress transient as24ci_cron_import_running using a transient management plugin or WP-CLI: `` wp transient delete as24ci_cron_import_running ``

Step 8: Investigate image queue worker failures

If images are not being processed after import:

  1. Check the plugin log for entries containing Image queue worker.
  2. Confirm the hook as24ci_image_queue_process is present in the WP-Cron event list.
  3. If the image queue lock (as24ci_image_queue_running) is stale, delete it: `` wp transient delete as24ci_image_queue_running `` The image queue lock has a 10-minute TTL and is also auto-cleared when stale.
  4. Check the Image queue last run stats on the System & Help tab for the count of processed, failed and remaining items.

Configuration reference

SettingLocationDescription
Enable automatic importImport & Limits → AutomationMaster switch for WP-Cron automation. Default: disabled.
ScheduleImport & Limits → AutomationImport frequency. Default: hourly.
Start timeImport & Limits → AutomationFor daily / twice-daily schedules. Default: 06:00 (site timezone).
Custom interval (minutes)Import & Limits → AutomationFor custom schedule. Minimum: 15 minutes. Default: 30 minutes.
Cron modeImport & LimitsControls which trigger type is used (wp-cron or server-cron).
Cron tokenImport & LimitsSecret token for the REST endpoint. Auto-generated. Can be regenerated.
Max vehicles per runImport & LimitsLimits vehicles processed per automated run. 0 = unlimited.
Image queue modeImport & LimitsQueue additional vehicle images for background processing. Default: enabled.

Operational notes

  • WP-Cron events require page load traffic to fire. On staging or development sites with no regular visitors, WP-Cron will not run reliably. Use the REST endpoint with a real server-cron job instead.
  • The import runner attempts to set a 300-second PHP execution time limit before running. On hosting that restricts set_time_limit, this may not succeed. The log will record a warning if this happens. Very large catalogues may time out on restrictive hosting.
  • The lock TTL for the main import is 40 minutes (2400 seconds). The lock for the image queue worker is 10 minutes (600 seconds).
  • The cron token is stored in plain text in WordPress options. Treat it as a secret. Do not share it in public forums or commit it to version control.
  • The image queue can hold up to 20,000 items before a warning is logged and a deduplication pass runs.
  • Running the import via the Trigger now admin button uses the same shared runner as WP-Cron and the REST endpoint. It is subject to the same lock and will be blocked if an import is already in progress.

Troubleshooting

SymptomLikely causeCheck
Imports not running automaticallyAuto-import disabledEnable automation in Import & Limits settings
as24ci_scheduled_import not in cron listEvent was unscheduled after settings changeRe-save automation settings to reschedule
DISABLE_WP_CRON is setWP-Cron is globally disabledUse server-cron or REST endpoint instead
Import fires but "already in progress" in logStale import lockWait 40 minutes or delete as24ci_cron_import_running transient
REST endpoint returns HTTP 403Token is wrong, missing or not configuredVerify token in Import & Limits settings
REST endpoint returns HTTP 429Import lock is activeWait and retry; if persistent, delete the lock transient
REST endpoint returns HTTP 500Exception during importCheck log for details
REST API not reachablePermalinks not set, or REST API blockedFlush permalinks; check security plugin settings
Image queue not processingWP-Cron cannot fire or image queue lock is staleVerify WP-Cron; delete as24ci_image_queue_running transient if stale
Last external cron time not updatingServer cron is not calling the endpoint or ?as24ci_cron=1 is not appendedVerify the cron job command and URL
Import times out on large cataloguePHP execution time too shortUse server-cron; contact hosting to increase PHP max execution time