मुख्य सामग्री पर जाएं

Async jobs and polling

अधिकांश write operations asynchronous होते हैं।

What returns immediately

ये endpoints काम स्वीकार करते हैं और IDs लौटाते हैं जिन्हें आप poll कर सकते हैं:
  • POST /projects
  • POST /projects/{projectId}/tasks/stem-separation
  • POST /projects/{projectId}/tasks/lyrics-sync
  • POST /projects/{projectId}/exports

What to poll

  • execution status और hydrated task output के लिए GET /tasks/{taskId} poll करें।
  • long-lived project state के लिए GET /projects/{projectId} पढ़ें।
  • fresh export download URLs के लिए GET /exports/{exportId} पढ़ें।

Practical polling model

  1. एक mutation शुरू करें और लौटाए गए IDs स्टोर करें।
  2. GET /tasks/{taskId} को तब तक poll करें जब तक task किसी terminal state तक न पहुँच जाए।
  3. stale cached state पर भरोसा करने के बजाय ID से durable resource को दोबारा पढ़ें।
  4. downloads के लिए, URL इस्तेमाल करने के लिए तैयार होने पर GET /exports/{exportId} fetch करें।

Why this matters

  • Task status execution timeline है।
  • Project state durable source of truth है।
  • Export download URLs को permanent की बजाय refreshable मानकर चलना चाहिए।