Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept TTL as seconds and as a float
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ def publish(self, body, routing_key=None, delivery_mode=None, | |
connection is lost. | ||
:keyword retry_policy: Retry configuration, this is the keywords | ||
supported by :meth:`~kombu.Connection.ensure`. | ||
:keyword expiration: A TTL can be specified on a per-message basis. | ||
:keyword expiration: A TTL in seconds can be specified per message. | ||
Default is no expiration. | ||
:keyword \*\*properties: Additional message properties, see AMQP spec. | ||
|
@@ -158,7 +158,7 @@ def publish(self, body, routing_key=None, delivery_mode=None, | |
delivery_mode = DELIVERY_MODES[delivery_mode] | ||
properties['delivery_mode'] = delivery_mode | ||
if expiration is not None: | ||
properties['expiration'] = str(expiration) | ||
properties['expiration'] = str(int(expiration*1000)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
clokep
|
||
|
||
body, content_type, content_encoding = self._prepare( | ||
body, serializer, content_type, content_encoding, | ||
|
I totally understand that this is a super old commit, but any guidance you might be able to provide would be incredibly helpful :)
QUESTION
What motivated the change to multiply the value of
expiration
by 1000? What does the 1000 represent (is it a conversion from microseconds to seconds?) What were old values ofexpiration
?CONTEXT
I'm using Celery (w/ a RedisBackEnd) + Kombu and am trying to track down the root cause of my custom task expiration values being ignored.
Thanks for all of your open source work to date --- no big rush on replying. Have a good day 👍