From c5eacdafaeda498539b2c6c2a8d5023132141043 Mon Sep 17 00:00:00 2001 From: Anastasis Andronidis Date: Thu, 12 Feb 2015 15:33:22 +0100 Subject: [PATCH] Accept TTL as seconds and as a float --- kombu/messaging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kombu/messaging.py b/kombu/messaging.py index 6f85662b8..fbc6b9261 100644 --- a/kombu/messaging.py +++ b/kombu/messaging.py @@ -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)) body, content_type, content_encoding = self._prepare( body, serializer, content_type, content_encoding,