فهرست منبع

Removes the CELERY_AMQP_TASK_RESULT_EXPIRES, in favor of CELERY_TASK_RESULT_EXPIRES

Ask Solem 13 سال پیش
والد
کامیت
0b1f8efdb6
3فایلهای تغییر یافته به همراه5 افزوده شده و 26 حذف شده
  1. 0 3
      celery/app/defaults.py
  2. 2 10
      celery/backends/amqp.py
  3. 3 13
      celery/tests/backends/test_amqp.py

+ 0 - 3
celery/app/defaults.py

@@ -91,9 +91,6 @@ NAMESPACES = {
     'CELERY': {
         'ACKS_LATE': Option(False, type='bool'),
         'ALWAYS_EAGER': Option(False, type='bool'),
-        'AMQP_TASK_RESULT_EXPIRES': Option(type='float',
-                deprecate_by='2.5', remove_by='4.0',
-                alt='CELERY_TASK_RESULT_EXPIRES'),
         'AMQP_TASK_RESULT_CONNECTION_MAX': Option(1, type='int',
                 remove_by='2.5', alt='BROKER_POOL_LIMIT'),
         'ANNOTATIONS': Option(type='any'),

+ 2 - 10
celery/backends/amqp.py

@@ -75,17 +75,9 @@ class AMQPBackend(BaseDictBackend):
         self.serializer = serializer or conf.CELERY_RESULT_SERIALIZER
         self.auto_delete = auto_delete
 
-        # AMQP_TASK_RESULT_EXPIRES setting is deprecated and will be
-        # removed in version 4.0.
-        dexpires = conf.CELERY_AMQP_TASK_RESULT_EXPIRES
-
         self.expires = None
-        if 'expires' in kwargs:
-            if kwargs['expires'] is not None:
-                self.expires = self.prepare_expires(kwargs['expires'])
-        else:
-            self.expires = self.prepare_expires(dexpires)
-
+        if 'expires' not in kwargs or kwargs['expires'] is not None:
+            self.expires = self.prepare_expires(kwargs.get('expires'))
         if self.expires:
             self.queue_arguments['x-expires'] = int(self.expires * 1000)
         self.mutex = threading.Lock()

+ 3 - 13
celery/tests/backends/test_amqp.py

@@ -76,16 +76,6 @@ class test_AMQPBackend(AppCase):
             tid = uuid()
             self.assertEqual(repair_uuid(tid.replace('-', '')), tid)
 
-    def test_expires_defaults_to_config_deprecated_setting(self):
-        app = app_or_default()
-        prev = app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES
-        app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES = 10
-        try:
-            b = self.create_backend()
-            self.assertEqual(b.queue_arguments.get('x-expires'), 10 * 1000.0)
-        finally:
-            app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES = prev
-
     def test_expires_is_int(self):
         b = self.create_backend(expires=48)
         self.assertEqual(b.queue_arguments.get('x-expires'), 48 * 1000.0)
@@ -269,14 +259,14 @@ class test_AMQPBackend(AppCase):
     def test_no_expires(self):
         b = self.create_backend(expires=None)
         app = app_or_default()
-        prev = app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES
-        app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES = None
+        prev = app.conf.CELERY_TASK_RESULT_EXPIRES
+        app.conf.CELERY_TASK_RESULT_EXPIRES = None
         try:
             b = self.create_backend(expires=None)
             with self.assertRaises(KeyError):
                 b.queue_arguments['x-expires']
         finally:
-            app.conf.CELERY_AMQP_TASK_RESULT_EXPIRES = prev
+            app.conf.CELERY_TASK_RESULT_EXPIRES = prev
 
     def test_process_cleanup(self):
         self.create_backend().process_cleanup()