Knowledge Base

Understanding the Sync Queue

Understanding the Sync Queue

The sync queue is the heart of Xero Sync, managing all synchronization operations between Blesta and Xero.

How the Queue Works

Event-Driven Queuing

When something happens in Blesta, an event is triggered:

  1. Invoice created → Queue invoice sync
  2. Payment received → Queue payment sync
  3. Client updated → Queue contact sync

Queue Processing

A cron task runs every 5 minutes to process the queue:

  1. Picks up pending items (oldest first)
  2. Attempts to sync each item to Xero
  3. Records success or failure
  4. Removes successful items
  5. Retries failed items (with exponential backoff)

Queue Page Overview

Navigate to Tools → Xero Sync → Queue to view:

Pending Items

Items waiting to be processed:

Column Description
Type Entity type (contact, invoice, payment)
ID Blesta entity ID
Action Operation (create, update)
Scheduled When it will be processed
Attempts Number of processing attempts

Failed Items

Items that failed after maximum retry attempts:

Column Description
Type Entity type
ID Blesta entity ID
Error Last error message
Attempts Total attempts made

Queue Operations

Process Queue Now

Manually trigger queue processing without waiting for cron:

  1. Click Process Queue Now
  2. The queue will be processed immediately
  3. Results are displayed on completion

Retry Failed Item

Requeue a single failed item for another attempt:

  1. Find the item in the Failed Items list
  2. Click Retry
  3. Item moves back to Pending with reset attempts

Retry All Failed

Requeue all failed items at once:

  1. Click Retry All Failed
  2. All failed items move to Pending
  3. Useful after fixing a systemic issue

Clear Queue

Remove all pending items:

  1. Click Clear Queue
  2. Confirm the action
  3. All pending items are deleted

Warning: Cleared items will not be synced. Use only when intentionally stopping sync operations.

Delete Item

Remove a single queue item:

  1. Find the item in the list
  2. Click Delete
  3. Item is permanently removed

Priority System

Items are processed by priority:

Priority Entity Type Reason
1 (High) Contact Must exist before invoices
5 (Normal) Invoice Standard priority
5 (Normal) Payment Processed after invoices

Retry Logic

Failed items use exponential backoff:

Attempt Delay Before Retry
1st fail 5 minutes
2nd fail 15 minutes
3rd fail 45 minutes
Max reached Marked as failed

Common Queue Scenarios

Queue Not Processing

  1. Check cron is running (Settings → Automation in Blesta)
  2. Verify the "Process Xero Sync Queue" task is enabled
  3. Check logs for errors

Items Stuck in Queue

  1. Items may be waiting for dependencies (contact before invoice)
  2. Check for API rate limiting (429 errors in logs)
  3. Try Process Queue Now to force processing

Too Many Failed Items

  1. Check Xero connection is active
  2. Review error messages for patterns
  3. Fix underlying issue, then Retry All Failed
Please rate this article to help us improve our Knowledge Base.

0 0