Skip to content

/listFinishedTasks unclear how to use or what the benefit is #101

@lionel-rowe

Description

@lionel-rowe

Per JavaScript/ocrsdk.js:

// Note: if your application queues several files and waits for them
// it's recommended that you use listFinishedTasks instead (which is described
// at https://ocrsdk.com/documentation/apireference/listFinishedTasks/).

It looks like the only sample that actually implements this recommendation is Java/Abbyy.Ocrsdk.client/srcProcessManyFiles.java:

private static void waitAndDownloadResults( Map<String,String> taskIds ) throws Exception {
// Call listFinishedTasks while there are any not completed tasks from taskIds
// Please note: API call 'listFinishedTasks' returns maximum 100 tasks
// So, to get all our tasks we need to delete tasks on server. Avoid running
// parallel programs that are performing recognition with the same Application ID

Given the limit of 100 results, sorted by date ascending (?!), and with no way of paginating, it's necessary to manually delete each completed task once it's been downloaded. This seems very flaky — if the program crashes before completion, leaving several tasks un-downloaded, those tasks will presumably just hang around taking up space on the list of returned tasks forever. Once the number of such zombie tasks reaches 100, calls to /listFinishedTasks will never return any relevant tasks, so the program will continue polling the endpoint forever until manually terminated.

Also, is there any real drawback to just polling /getTaskStatus for each ongoing task? It's not clear what the benefit of polling /listFinishedTasks is, given the increased complexity and flakiness. Presumably calls to /getTaskStatus are cheap, as they don't send or return much data or do any processing, just check a status.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions