Skip to main content
GET
/
v1
/
async
/
status
Get async queue status
curl --request GET \
  --url https://api.cloro.dev/v1/async/status \
  --header 'Authorization: Bearer <token>'
{
  "queuedTasks": 3,
  "processingTasks": 2,
  "concurrency": {
    "used": 2,
    "max": 5
  }
}

Overview

This endpoint provides real-time visibility into your organization’s async task queue and processing capacity. Use it to:
  • Monitor queue health: Track how many tasks are waiting to be processed
  • Understand processing capacity: See current concurrency usage versus your plan limit
  • Debug delays: Identify if tasks are queued due to high volume or concurrency limits
  • Plan capacity: Make informed decisions about upgrading your plan based on actual usage
The response includes three key metrics:
  • queuedTasks: Number of tasks currently waiting in the queue (status: QUEUED)
  • processingTasks: Number of tasks actively being processed (status: PROCESSING)
  • concurrency: Current concurrency slot usage compared to your plan’s maximum

Response fields

FieldTypeDescription
queuedTasksintegerNumber of tasks currently queued for your organization
processingTasksintegerNumber of tasks currently being processed for your organization
concurrency.usedintegerNumber of concurrent slots currently in use
concurrency.maxintegerMaximum allowed concurrent tasks for your organization (based on your plan)
The concurrency object may be null if concurrency information cannot be retrieved at the time of the request. This is rare but can occur during system maintenance.

Example usage

Check current queue status

curl -X GET "https://api.cloro.dev/v1/async/status" \
  -H "Authorization: Bearer sk_live_1234567890abcdef1234567890abcdef"

Monitor queue status programmatically

import axios from 'axios';

const API_KEY = process.env.API_KEY;
const STATUS_URL = 'https://api.cloro.dev/v1/async/status';

async function checkQueueStatus() {
  try {
    const response = await axios.get(STATUS_URL, {
      headers: {
        'Authorization': `Bearer ${API_KEY}`
      }
    });

    const { queuedTasks, processingTasks, concurrency } = response.data;

    console.log(`Queue status:`);
    console.log(`  Queued: ${queuedTasks} tasks`);
    console.log(`  Processing: ${processingTasks} tasks`);

    if (concurrency) {
      console.log(`  Concurrency: ${concurrency.used}/${concurrency.max} slots used`);
      console.log(`  Available: ${concurrency.max - concurrency.used} slots`);
    }

    // Alert if queue is getting large
    if (queuedTasks > 100) {
      console.warn('Warning: Queue has over 100 tasks waiting');
    }

    // Alert if approaching concurrency limit
    if (concurrency && concurrency.used / concurrency.max > 0.8) {
      console.warn('Warning: Using over 80% of concurrency limit');
    }

    return response.data;
  } catch (error) {
    console.error('Error checking queue status:', error.message);
    throw error;
  }
}

// Check status every 30 seconds
setInterval(checkQueueStatus, 30000);

Use cases

Capacity planning

Monitor concurrency usage patterns to determine if you need to upgrade your plan:
const stats = await checkQueueStatus();

// If consistently at or near max concurrency, consider upgrading
if (stats.concurrency.used >= stats.concurrency.max * 0.9) {
  console.log('Consider upgrading to a higher plan for better throughput');
}

Queue health monitoring

Track queue size to detect processing bottlenecks or high-volume periods:
data = check_queue_status()

# Alert if queue is backing up
if data['queuedTasks'] > 1000:
    send_alert('High queue volume - consider optimizing task submission')

Throttling task submission

Adjust your task submission rate based on current queue status:
const status = await checkQueueStatus();

// Only submit more tasks if queue is manageable
if (status.queuedTasks < 500) {
  await submitNextBatch();
} else {
  console.log('Queue is full, waiting before submitting more tasks');
  await delay(60000); // Wait 1 minute
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Successful response with queue metrics.

queuedTasks
integer

Number of tasks currently queued for this organization.

Example:

3

processingTasks
integer

Number of tasks currently being processed for this organization.

Example:

2

concurrency
object

Current concurrency usage. Null if unable to retrieve concurrency information.