Skip to content
Developers

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.

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.

List every collection that has had an import since the service last started:

Terminal window
GET /tasks

This 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:

Terminal window
curl "https://answers.tallyfy.com/tasks" \
-H "Authorization: Bearer your_api_key"

Stop the import for a collection by naming the collection:

Terminal window
DELETE /tasks/{collection_name}

Example:

Terminal window
curl -X DELETE "https://answers.tallyfy.com/tasks/docs" \
-H "Authorization: Bearer your_api_key"

The service replies with one of these:

  • 200 with {"message": "Task stopped for collection: docs"}
  • 404 with {"message": "No task found for collection: docs"}
  • 403 when the Authorization header is missing or doesn’t match the API key

Objects indexed before you stop an import stay in the collection.

Task management is useful for:

  1. Troubleshooting - Stop a stuck or unwanted import
  2. Deleting a collection - Stop its import first, because deleting the collection doesn’t stop it
  3. 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/metadata during 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.

Answers > Objects

Objects are the JSON records you store in a Tallyfy Answers collection. They’re indexed in…