I have a model that has a state field which can be draft or published, and has a scheduled_publish_time datetime field which allows scheduling its publishing.
The user specifies a datetime at which they want the model to be published, and a celery task is scheduled using apply_async
with the eta
argument set to that value.
The problem is, if the datetime is set too far in the future, I get this error eventually:
amqp.exceptions.PreconditionFailed: (0, 0): (406) PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more
I am using RabbitMQ as the broker for celery.
I googled it and it seems it’s a common issue. Some suggest just increasing the timeout, but I am not sure it’s a good idea. Ideally, I would allow scheduling these tasks very far in the future, possibly months ahead, so I don’t think putting a huge timeout is the wisest thing.
Is there a better way to handle this issue?