Objects > Index multiple objects
Tasks
How do background tasks work in Tallyfy Answers?
Section titled “How do background tasks work in Tallyfy Answers?”Tallyfy Answers runs batch imports in the background, so the import request returns without waiting for every object to be indexed. Batch imports are the only background task.
What are background tasks?
Section titled “What are background tasks?”Each batch import runs as one task, named after its collection. A collection has at most one task: starting a new import for it stops the one already running.
How do you list tasks?
Section titled “How do you list tasks?”List every collection that has had an import since the service last started:
GET /tasksThis endpoint needs the API key. It returns collection names only, with no status, progress or timing:
{ "message": ["docs"]}Finished imports stay on the list. A task leaves it only when you stop it or a new import for that collection replaces it, so the list doesn’t tell you whether an import is still running.
Example:
curl "https://answers.tallyfy.com/tasks" \ -H "Authorization: Bearer your_api_key"How do you cancel a running task?
Section titled “How do you cancel a running task?”Stop the import for a collection by naming the collection:
DELETE /tasks/{collection_name}Example:
curl -X DELETE "https://answers.tallyfy.com/tasks/docs" \ -H "Authorization: Bearer your_api_key"The service replies with one of these:
200with{"message": "Task stopped for collection: docs"}404with{"message": "No task found for collection: docs"}403when theAuthorizationheader is missing or doesn’t match the API key
Objects indexed before you stop an import stay in the collection.
When should you use task management?
Section titled “When should you use task management?”Task management is useful for:
- Troubleshooting - Stop a stuck or unwanted import
- Deleting a collection - Stop its import first, because deleting the collection doesn’t stop it
- Clearing the list - Stop finished tasks to remove them from the list
What are best practices for task management?
Section titled “What are best practices for task management?”- Check progress with counts - The task list has no progress data, so compare counts from
GET /collections/{collection_name}/objects/metadataduring a long import - Cancel Stuck Tasks - Remove tasks that appear frozen or taking too long
- Re-send after a restart - The task list lives in memory, so a restart or deploy of the service empties it and ends any running import. Send the file again, and objects already indexed are updated, not duplicated.
- Regular Cleanup - Stop finished tasks to clear them from the list. There’s no queue.
Related articles
Section titled “Related articles”Collections > Delete a collection