Skip to main content
GET
https://api.tornadoapi.io
/
dashboard
/
cluster
Cluster Stats
curl --request GET \
  --url https://api.tornadoapi.io/dashboard/cluster \
  --header 'x-api-key: <x-api-key>'
{
  "total_downloading": 45,
  "total_muxing": 12,
  "total_uploading": 8
}

Overview

Returns real-time statistics about what’s happening across all worker nodes in the cluster. This endpoint is polled every second by the dashboard for live updates.

Header Parameters

x-api-key
string
required
Your API key for authentication

Response

total_downloading
integer
Number of videos currently being downloaded across all nodes
total_muxing
integer
Number of videos currently being processed with FFmpeg
total_uploading
integer
Number of files currently being uploaded to S3

Example

curl -X GET "https://api.tornadoapi.io/dashboard/cluster" \
  -H "x-api-key: sk_your_api_key"

Success Response

{
  "total_downloading": 45,
  "total_muxing": 12,
  "total_uploading": 8
}

Error Responses

{
  "error": "Missing x-api-key header"
}

Usage

This endpoint is polled every second by the dashboard for real-time updates:
let clusterInterval = null;

function startClusterPolling(apiKey) {
  // Clear any existing interval to prevent memory leaks
  if (clusterInterval) clearInterval(clusterInterval);

  clusterInterval = setInterval(async () => {
    // Only poll when tab is visible
    if (document.hidden) return;

    try {
      const response = await fetch('/dashboard/cluster', {
        headers: { 'x-api-key': apiKey }
      });
      const stats = await response.json();

      document.getElementById('downloading').textContent = stats.total_downloading;
      document.getElementById('muxing').textContent = stats.total_muxing;
      document.getElementById('uploading').textContent = stats.total_uploading;
    } catch (e) {
      // Silently ignore errors for real-time updates
    }
  }, 1000);
}

// Don't forget to clear on logout/cleanup
function stopClusterPolling() {
  if (clusterInterval) {
    clearInterval(clusterInterval);
    clusterInterval = null;
  }
}
Always clear the interval when the user logs out or navigates away to prevent memory leaks.

How It Works

Each worker node reports its status to Redis every second with:
  • Current download/mux/upload counts
  • Hostname and IP address
  • Timestamp (heartbeat)
The cluster endpoint aggregates all nodes with a heartbeat within the last 30 seconds.