Misleading information in Django Tasks documentation

I plan to use the Django Tasks framework with a view enqueuing a Task for background processing, but which will not return immediately, giving the oppotunity to background workers to finish the task before returning a response to the client (i.e. if the task finishes within a reasonable time, the view can return a 200 response with the result, otherwise it will return a 202 response with the Task id).

The view which enqueues the task would call Task.get_result() to retrieve the result.

For testing purpose, I’d like to use some Immediate backend where result could be retrieved using .get_result()immediately after enqueueing task (so that my view will have a single implementation whatever tasks backend is used).

This note in the Django tasks documentation says:

The ImmediateBackend doesn’t officially support get_result(), despite implementing the API, since the result cannot be retrieved from a different thread.

So even if not official, I should be able to use .get_result() on the ImmediateBackend because it is supposed to implement it (“despite implementing the API”), but, as far as I can see, there is no implementation of the .get_result() method in sources.

Is the documentation wrong saying “despite implementing the API”, or am I missing something ?

1 Like