<p dir="auto">I am calling the celery tasks by task.delay, task.appy_asyn or send_task but each of these methods hang for ever when the broker is not started. I am using celery version 4.1.0.<br>
I thought the action would expire and throw exception after default timeout. Is there any way to stop the application waiting for ever.<br>
I also specified the retry_policy parameters while calling tasks but they do not make any difference.</p>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?utf8=%E2%9C%93&amp;q=is%3Aissue+label%3A%22Category%3A+Documentation%22+">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues in this issue<br>
(If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>PR: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="397093531" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/5275" data-hovercard-type="pull_request" data-hovercard-url="/celery/celery/pull/5275/hovercard" href="https://github.com/celery/celery/pull/5275">#5275</a> (status is open, but feature is already present since Celery v4.4.0)</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h1 dir="auto">Description</h1>

<p dir="auto">First off, documentation is not especially wrong on the use of DynamoDB as a results backend. However, it is incomplete in a significant way. Because I manage the DynamoDB table through IaC I did not realize that defining a sort key would break compatibilty with Celery.</p>
<p dir="auto">When you use a DynamoDB table with a <a href="https://aws.amazon.com/blogs/database/using-sort-keys-to-organize-data-in-amazon-dynamodb/" rel="nofollow">sort key</a> you can not use Celery v4.4 versions &gt;= v4.4.3. The reason is commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/celery/celery/commit/c711047036819cbe003dcfbd81fc35bb0b4af5d3/hovercard" href="https://github.com/celery/celery/commit/c711047036819cbe003dcfbd81fc35bb0b4af5d3"><tt>c711047</tt></a> which introduces a query of existing Celery result status. When you have a sort key defined for your DynamoDB table, the primary key is no longer <em>just</em> the partition key ('id'), but a combination of the partition and sort keys ('id' and 'timestamp' in my case).</p>
<h1 dir="auto">Suggestions</h1>

<p dir="auto">It would be fun to add sort key support to the DynamoDB results backend, but I fear it will not be possible. For example, in my case I will need to know the value of the 'timestamp' in addition to the 'id' of the result item we need to retrieve. I don't believe Celery has knowledge of the 'timestamp' we are looking for at the time the query from commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/celery/celery/commit/c711047036819cbe003dcfbd81fc35bb0b4af5d3/hovercard" href="https://github.com/celery/celery/commit/c711047036819cbe003dcfbd81fc35bb0b4af5d3"><tt>c711047</tt></a> is performed.</p>
<p dir="auto">So my suggestion is simple: Let's add a line in the documentation about DynamoDB use as results backend that warns us that you cannot use a sort key on the table. Luckily, you could still add a <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html" rel="nofollow">global secondary index (GSI)</a> if you want to perform queries based on something other than the partition key. A GSI will not break the primary key schema for the queries from Celery.</p>